Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 20 Apr 2014, 22:10
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Multimedia
Convert wav to mp3 with a right click option
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 3 [37 Posts]   Goto page: Previous 1, 2, 3 Next
Author Message
RSH


Joined: 05 Sep 2011
Posts: 2036
Location: Germany

PostPosted: Wed 26 Oct 2011, 22:35    Post subject:  

Hello, don570!

Tonight i have discovered your Rightclick-Audioconversiontool. It was a nice Surprise to me, to find my translation added to this Tool. I am lucky about that, and so i have downloaded it and installed it in my Puppy Studio rebuild No. 37.

I works fine, and: I LIKE IT!

Nice Work and the Code is truly education to me. I am just a beginner in writing GUIS for some Tools. May be you are interested in my GUI for the Bristol Software Synthesizers, they can be found here: http://www.mediafire.com/file/6pr21567d6x247f/bristol-0.40.8-1-i386-GUI.pet. Also the Bristol Synthesizers: http://www.mediafire.com/file/xm7q4jb990z6gpj/bristol_0.40.8-1_i386.pet

To let you understand, how much i like this Tool, i'd started to make a translation for the folder-convert-1.1.pet. So, here is the folder_convert-NLS-de-1.1.pet, with only the german translation within.

Please add this one to your NLS-File - if you like to do so.

Wish you well,

RSH
folder_convert-NLS-de-1.1.pet
Description 
pet

 Download 
Filename  folder_convert-NLS-de-1.1.pet 
Filesize  1.09 KB 
Downloaded  185 Time(s) 
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Thu 27 Oct 2011, 19:40    Post subject:  

Thanks for the translation.

folder_convert was an experiment. I don't have training in
programming so I wrote it in a strange way
that professionals would laugh at, I'm sure.

..but it seems to work, so I posted it along with conversion_audio
which ought to be in every Puppy.
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2036
Location: Germany

PostPosted: Fri 28 Oct 2011, 22:17    Post subject:  

Hello don570,

i like your .pet stuff and even the code. I've been a programmer for years and years back there, from 1990 to 2007. But, in PASCAL and doing it using another OS: the TOS, AtariST Series. Later using the TOSBOX on Windows ME, wich gives me 14 MB RAM and a whole lot of speed. Sometimes i have to make some scrolling-functions in my own programs a little less faster manually by programming-code.

Now let's take a look at my Problem. It has to do with the code from your rightclick audio stuff. While i am reading your code, i am trying to translate it to PASCAL.
I hope it will help me a little, to understand this script-programming-code (has it got a name, like PASCAL, C++ or JAVA).

Let me explain: if i'm writing "extension", this means to me the (almost) three characters after the dot. (.pet for example)

Code:
z=`echo "$1" | sed "s/\/$//"`
t="${z%.*}"


z=`echo "$1" | sed "s/\/$//"` gives me the full path- and filename after the mouseclick, right?
After "t="${z%.*}"[/code]" there's only the full path- and filename without the extension, right?

Or am i totally wrong?

So, i want this code to return to me

1. the full path- and filename WITH extension
2. the full path- and filename WITHOUT extension
3. only the filename

2. and 3. maybe can be done by me, using string-functions like the PASCAL-functions (delete, insert concat etc). L18L shows me some equivalents.

In PASCAL we call them STRINGS and i need these strings in a form or way to do something with them like copy, delete and insert parts of them or other strings, declared by myself.

Can you help me? Any Idea?

What is
Code:
"$1"
, ist it the right mouse-button?

What is echo doing here?
Code:
sed "s/\/$//


What is t doing here?
Code:
t="${z%.*}"


RSH
rshs-score-screens.png
Description  The Score-Editor (Drumscores without MIDI but multiple DTP Functions)
png

 Download 
Filename  rshs-score-screens.png 
Filesize  308.26 KB 
Downloaded  171 Time(s) 

Last edited by RSH on Wed 09 Nov 2011, 10:28; edited 1 time in total
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Sat 29 Oct 2011, 12:47    Post subject:  

You seem to know more about programming
than me. It's the blind leading the blind. Laughing

Here's a tip that has been invaluable for me.

If a script isn't working, then insert the following:
Code:
gxmessage bingo

This shows me if I have reached a certain part in a
script. This is especially valuable in loops.

As well I find often that there is a need to
find out the variables value so I insert the
following line
Code:
 gxmessage   APP_LIST= "$APP_LIST"

to find the value of a variable named APP_List.

I often write small scripts in /root to check out
my theories on how a script will act.

There's a list of free info here -->

http://murga-linux.com/puppy/viewtopic.php?t=71288

I personally use this for any Bash scripting I've done--->
http://www.murga-linux.com/puppy/viewtopic.php?t=40422

Quote:
What is
Code:
"$1"


It look like a simple inputing of a variable.
If you had three inputs, they would be automatically
named $1 $2 $3 by bash shell.


Quote:
What is echo doing here?
Code:
sed "s/\/$//


Programmers like to stick an echo line by itself
to show a blank line in the terminal.
Is that what is confusing you?
I should have taken it out if I left it in.

Quote:
What is t doing here?
Code:
t="${z%.*}"

That looks like some clumsy coding by me.
I should have given descriptive variable names
rather than letters. It's a bad habit I've gotten into.
You should avoid doing it. A gxmessage line should find out
what it is. Note that I used quotes to preserve the whitespace!!!



If you read the script found here
http://www.murga-linux.com/puppy/viewtopic.php?t=71927
there's use of 'dirname' and 'basename' which I've avoided
doing, mainly because of my lack of knowledge,
but also because they don't appear to work in functions
and child processes.

If you want to know about a line of script I've written you
should give me a line number --> It's a menu option in Geany.


___________________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Mon 31 Oct 2011, 20:31    Post subject: loop example  

A script to understand loops that I have found.
The 'shift' command is used to switch to a new argument in
the list.

Code:
#!/bin/bash
echo "Argument value is: $1"

while [ "$*" != "" ]
do
echo "Argument value is: $1"
shift
done


Here is terminal output for different inputs

# ./script a b c d
Argument value is: a
Argument value is: a
Argument value is: b
Argument value is: c
Argument value is: d


The double quotation mark does protect whitespace

# ./script "a b" "c d"
Argument value is: a b
Argument value is: a b
Argument value is: c d

_______________________________________

Last edited by don570 on Tue 01 Nov 2011, 20:07; edited 1 time in total
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Mon 31 Oct 2011, 20:33    Post subject:  

another loop example with for statement

Code:

#!/bin/bash
echo "Argument value is: $1"

for item in "$@"
do
echo "Argument value is: $item"
done




terminal output is


# ./script 1 2 4 6
Argument value is: 1
Argument value is: 1
Argument value is: 2
Argument value is: 4
Argument value is: 6
Back to top
View user's profile Send private message 
RSH


Joined: 05 Sep 2011
Posts: 2036
Location: Germany

PostPosted: Mon 31 Oct 2011, 23:58    Post subject:  

Hello don570,

thank you for your help.

After help and hints from big_bass, emil, L18L, PANZERKOPF, rhadon and you, i was able to create the tool, i wanted to create. It works fine. Now i have to put all these things together (saving to hd) and study it. There's a lot of documentation i've found.

The Tool is created as ROX-App, like your Audiotools. The Code is fully commended in german and english. So, i think, you should take a look inside, because if have found out something interesting about:

Code:
t="${z%.*}"


The pet is here:

http://murga-linux.com/puppy/viewtopic.php?t=72872&start=15

RSH

Edit:

Quote:
You seem to know more about programming
than me. It's the blind leading the blind. Laughing


Let me tell you something to this. From Time to Time i've been working as a teacher for playing drums. In the private sector and even on schools. So, everytime i've teached anybody, i've learned something at the same time. And for sure, i've learned from your posts as well.
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Tue 01 Nov 2011, 20:04    Post subject:  

I've been studying loops and here's some things
I've learned. I show the script ,
then the output in the terminal.

Here's a quick way of making a list for a loop
to use each word as an argument
Code:

#!/bin/bash

LIST='apple orange pear plum'
for item in $LIST
do
echo "Argument value is: $item"
done

# ./script
Argument value is: apple
Argument value is: orange
Argument value is: pear
Argument value is: plum

Here is the usual way programmers make a list
Code:
#!/bin/bash

LIST='apple
orange
pear
plum'
for item in $LIST
do
echo "Argument value is: $item"
done

# ./script
Argument value is: apple
Argument value is: orange
Argument value is: pear
Argument value is: plum

Double quotation marks are useless as this example
shows...
Code:
#!/bin/bash

LIST=$(echo "ap ple" orange pear plum)
for item in $LIST
do
echo "Argument value is: $item"
done
 

# ./script
Argument value is: ap
Argument value is: ple
Argument value is: orange
Argument value is: pear
Argument value is: plum


Now I change the IFS (Internal Field Separator) to a comma
and the white space is protected
Code:
#!/bin/bash
IFS=,
LIST='ap ple,orange,pear,plum'
for item in $LIST
do
echo "Argument value is: $item"
done


# ./script
Argument value is: ap ple
Argument value is: orange
Argument value is: pear
Argument value is: plum
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Sat 05 Nov 2011, 15:00    Post subject: loop example  

The following example will loop three times
even though there are 4 arguments

Code:

#!/bin/bash
 
x=1
while [ $x -le 3 ]
do
echo “argument is ....$1″
shift
x=`expr $x + 1`
done


# ./Script "ap ple" orange pear plum
“argument is ....ap ple″
“argument is ....orange″
“argument is ....pear″

Last edited by don570 on Wed 09 Nov 2011, 16:26; edited 2 times in total
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Sat 05 Nov 2011, 15:07    Post subject: new version folder_convert 1.2  

new version folder_convert 1.2

folder_convert has been fixed to show foreign languages properly.

I dumped the old yaf-splash and now use xdialog


______________________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Wed 09 Nov 2011, 16:24    Post subject: dejan script  

Here's a script based on dejan's work.
It allows sed command to work on text that has
whitespace .


Code:

#!/bin/sh
FIND="/ap ple/"
ADD="/root/"
echo "/ap ple/spot" |  sed  's:^'"$FIND"':'"$ADD"':'



The terminal output is


# ./Script
/root/spot


_________________________________________________

Here's a script I wrote to
study positional characters i.e number of inputs --> $#
and to study exit status ---> $?
Code:

#!/bin/bash
echo number of positional characters = $#

until [ -z "$1" ]  # Until all parameters used up . . .
do
echo -n "$1 "
shift
done
echo               # Extra line feed.
echo "$?"          # Determine exit status
if [ -z "$0" ] ; then
echo
else
echo "$?"
echo "$0"
echo "$?"
fi
exit 0



# ./script a b c
number of positional characters = 3
a b c
0
1
./script
0

_______________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Mon 14 Nov 2011, 15:06    Post subject:  

Here's a script I found to do simple calculations

Code:

#!/bin/bash
# Simple linux bash calculator
echo "Enter input:"
read userinput
echo "Result with 2 digits after decimal point:"
echo "scale=2; ${userinput}" | bc
echo "Result with 10 digits after decimal point:"
echo "scale=10; ${userinput}" | bc
echo "Result as rounded integer:"
echo $userinput | bc


...and the terminal output.
# ./script
Enter input:
2+2
Result with 2 digits after decimal point:
4
Result with 10 digits after decimal point:
4
Result as rounded integer:
4
# ./script
Enter input:
2*8
Result with 2 digits after decimal point:
16
Result with 10 digits after decimal point:
16
Result as rounded integer:
16
# ./script
Enter input:
8/4
Result with 2 digits after decimal point:
2.00
Result with 10 digits after decimal point:
2.0000000000
Result as rounded integer:
2

____________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Mon 14 Nov 2011, 15:09    Post subject:  

Here's a script I found that does renaming(recursively)
of filenames that have whitespace .

Code:

#!/bin/sh

# This bash script will locate and replace spaces
# in the filenames
DIR="."
# Controlling a loop with bash read command by redirecting STDOUT as
# a STDIN to while loop
# find will not truncate filenames containing spaces
find $DIR -type f | while read file; do
# using POSIX class [:space:] to find space in the filename
if [[ "$file" = *[[:space:]]* ]]; then
# substitute space with "_" character and consequently rename the file
mv "$file" `echo $file | tr ' ' '_'`
fi;
# end of while loop
done


_____________________________________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Sat 19 Nov 2011, 15:21    Post subject:  

French German Spanish Finnish Italian Portugese Dutch
languages now supported

More languages are now supported by conversion_audio
thanks to

Béèm
ferro10n

Instructions to help in conversion effort are here
http://www.murga-linux.com/puppy/viewtopic.php?t=72856

_________________________________________
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3078
Location: Ontario

PostPosted: Sat 21 Jan 2012, 17:30    Post subject:  

Here I tested a new way of inputing variable values
using curly brackets.
Also there is a line in the script to
experiment with the test command ---> [
which is the square bracket. The output is zero
because 5 does not equal 9. The terminal output shows
this outcome.

Code:

#!/bin/sh

FILENAME=$1
EXTENSION=$2
echo $@
[ 5 != 9 ]
echo $?
aplay /root/puppy-reference/audio/${FILENAME}${EXTENSION}
exit 0


Here's the terminal output. Note that there is two inputs
2barks and the extension .wav

Code:

# ./script 2barks .wav
2barks .wav
0
Playing WAVE '/root/puppy-reference/audio/2barks.wav'
: Signed 16 bit Little Endian, Rate 8000 Hz, Mono



________________________________________
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 3 [37 Posts]   Goto page: Previous 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Multimedia
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1101s ][ Queries: 12 (0.0051s) ][ GZIP on ]