mp3's down sampling and wave to mp3's and lame

Discussion in 'NZ Computing' started by Robert Cooze, Jan 6, 2007.

  1. Robert Cooze

    Robert Cooze Guest

    Now I am using linux but could apply to windows I guess. I do a lot of
    recording of lp's and tapes wich I edit and want to batch convert to MP3.

    Been googling and came accross these jems

    ls -1 *.mp3 | sed "s/\(.*\)\.mp3/\1.mp3 \1_128.mp3/" |xargs -n 2 lame -h

    a down sample command and edited it to

    ls -1 *.wav | sed "s/\(.*\)\.wav/\1.wav \1_vbr.mp3/" |xargs -n 2 lame
    --preset standard

    and

    ls -1 *.wav | sed "s/\(.*\)\.wav/\1.wav \1_128.mp3/" |xargs -n 2 lame -h

    these work good!

    but found a bash script to do more or less of the same

    #!/bin/bash

    clear
    echo
    echo autolame V 0.12
    echo
    echo "autolame was written by Lawrence Shafer"
    echo "Please send any flames, laughter hugs and"
    echo "updates/enhancements to lawrence(at)pastimes.cc"
    sleep 5

    # Usage Instructions.

    # 0 make sure you have lame installed!
    # 1 Copy this file to /usr/bin/autolame.
    # 2 cd to the directory where the wav's are that you want to convert.
    # 3 type autolame
    # 4 they're done!

    # need to ad arg for lame command line and for in/out filenames so you
    dont have to run it in the wav folder

    # Get all files in current directory
    myWavFiles=$(ls *.wav)

    # Go through the wav's and convert them
    for oldWav in $myWavFiles

    do

    clear
    echo
    echo auto-lame V 0.12
    echo
    # Get original filename without .Wav extension
    originName=$(echo $oldWav|awk '{sub(".wav"," ");print $1}');
    echo $originName
    echo

    # Create the new filename including .mp3
    newMp3=$originName".mp3"

    echo "Encoding $oldWav to $newMp3";
    echo
    echo
    # Convert it
    lameit=$(lame -h $oldWav $newMp3);
    done


    I haven't tested it but how easy would it be to make the bash script
    interactive so It could to the wave to mp3 and mp3 to mp3 downsample and
    or change the quality would also like to put the output into a different
    directory

    I sort of get the way the switches work I ain't a programmer by any
    stretch of the imagination pointers and advice would be much appreciated

    now I know I could proberly get a all sining and dancing program with
    gut to boot but this is something for fun





    --
    http://cooze.co.nz home of the RecyclerMan aka Robert Cooze

    / __/ / / / / /__ / / ___/ / __/ / / / |/ / /__ /
    / / / /_/ / / /_/ / _-' / __/ / / / /_/ / / /| / _-'
    ___\ ____/ ____/ /___/ /____/ /_/ ___\ ____/ /_/ /_/ |_/ /___/
     
    Robert Cooze, Jan 6, 2007
    #1
    1. Advertising

  2. Robert Cooze

    Rob S Guest

    #!/bin/bash
    echo "Choose a menu number"
    echo "1. Wav to mp3"
    echo "2. Mp3 to wav"
    echo "3. Mp3 to mp3 downsample"
    read word
    if [ "$word" = "1" ]; then
    lame ....
    elif [ "$word" = "2" ]; then
    lame -decode ....
    elif [ "$word" = "3" ]; then
    lame ....
    else
    echo "Unable to parse your answer"
    exit
    fi


    Add nested if then else loops to choose directory etc.

    Or you could use the case statement
    --

    Rob
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    http://aspir8or.googlepages.com/blog
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


    Students nowadays, complaining they only get 5MBs of disk space! In my
    day we were lucky if we had one file, and that was /dev/null.
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
    Rob S, Jan 7, 2007
    #2
    1. Advertising

  3. Robert Cooze

    Mathew Good Guest

    On Sun, 07 Jan 2007 11:25:32 +1300, Robert Cooze <> wrote:

    >Now I am using linux but could apply to windows I guess. I do a lot of
    >recording of lp's and tapes wich I edit and want to batch convert to MP3.
    >
    >Been googling and came accross these jems
    >
    >ls -1 *.mp3 | sed "s/\(.*\)\.mp3/\1.mp3 \1_128.mp3/" |xargs -n 2 lame -h
    >
    >a down sample command and edited it to
    >
    >ls -1 *.wav | sed "s/\(.*\)\.wav/\1.wav \1_vbr.mp3/" |xargs -n 2 lame
    >--preset standard
    >
    >and
    >
    >ls -1 *.wav | sed "s/\(.*\)\.wav/\1.wav \1_128.mp3/" |xargs -n 2 lame -h
    >
    >these work good!
    >
    >but found a bash script to do more or less of the same
    >
    >#!/bin/bash
    >
    >clear
    >echo
    >echo autolame V 0.12
    >echo
    >echo "autolame was written by Lawrence Shafer"
    >echo "Please send any flames, laughter hugs and"
    >echo "updates/enhancements to lawrence(at)pastimes.cc"
    >sleep 5
    >
    ># Usage Instructions.
    >
    ># 0 make sure you have lame installed!
    ># 1 Copy this file to /usr/bin/autolame.
    ># 2 cd to the directory where the wav's are that you want to convert.
    ># 3 type autolame
    ># 4 they're done!
    >
    ># need to ad arg for lame command line and for in/out filenames so you
    >dont have to run it in the wav folder
    >
    ># Get all files in current directory
    >myWavFiles=$(ls *.wav)
    >
    ># Go through the wav's and convert them
    >for oldWav in $myWavFiles
    >
    >do
    >
    > clear
    > echo
    > echo auto-lame V 0.12
    > echo
    > # Get original filename without .Wav extension
    > originName=$(echo $oldWav|awk '{sub(".wav"," ");print $1}');
    > echo $originName
    > echo
    >
    > # Create the new filename including .mp3
    > newMp3=$originName".mp3"
    >
    > echo "Encoding $oldWav to $newMp3";
    > echo
    > echo
    > # Convert it
    > lameit=$(lame -h $oldWav $newMp3);
    >done
    >
    >
    >I haven't tested it but how easy would it be to make the bash script
    >interactive so It could to the wave to mp3 and mp3 to mp3 downsample and
    >or change the quality would also like to put the output into a different
    >directory
    >
    >I sort of get the way the switches work I ain't a programmer by any
    >stretch of the imagination pointers and advice would be much appreciated
    >
    >now I know I could proberly get a all sining and dancing program with
    >gut to boot but this is something for fun




    Why not Spend some money are get a REAL Program not that stuff that is out of the Ark..
     
    Mathew Good, Jan 7, 2007
    #3
  4. Robert Cooze

    Pleb Plebian Guest

    "Rob S" <Here@home> wrote in message news:45a05baf$...
    > #!/bin/bash
    > echo "Choose a menu number"
    > echo "1. Wav to mp3"
    > echo "2. Mp3 to wav"
    > echo "3. Mp3 to mp3 downsample"
    > read word
    > if [ "$word" = "1" ]; then
    > lame ....
    > elif [ "$word" = "2" ]; then
    > lame -decode ....
    > elif [ "$word" = "3" ]; then
    > lame ....
    > else
    > echo "Unable to parse your answer"
    > exit
    > fi
    >
    >
    > Add nested if then else loops to choose directory etc.
    >
    > Or you could use the case statement
    > --
    >
    > Rob
    > - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    > http://aspir8or.googlepages.com/blog


    Damn! This script actually makes sense......

    Think I'm gonna have to build a 'nix box (finally...) to play: so- given I'm
    a 'nux noob, (and a Win superuser - c.f. an alpha or beta geek ;-)
    -what distro would be suggested?

    -am looking for something easy to learn and able to be run on a basic
    box -say PIII/500, 256 MB RAM and generic video-oh, with as much as possible
    configurable via a GUI.
    Will get more adventurous once I have *some* knowledge <smile>
    TIA for any info -and Wodger <aka M. Good> need not apply...
    Thanks,
    -Darl [Pleb}
     
    Pleb Plebian, Jan 7, 2007
    #4
  5. Robert Cooze

    Rob S Guest

    Pleb Plebian wrote:
    > "Rob S" <Here@home> wrote in message news:45a05baf$...
    >> #!/bin/bash
    >> echo "Choose a menu number"
    >> echo "1. Wav to mp3"
    >> echo "2. Mp3 to wav"
    >> echo "3. Mp3 to mp3 downsample"
    >> read word
    >> if [ "$word" = "1" ]; then
    >> lame ....
    >> elif [ "$word" = "2" ]; then
    >> lame -decode ....
    >> elif [ "$word" = "3" ]; then
    >> lame ....
    >> else
    >> echo "Unable to parse your answer"
    >> exit
    >> fi
    >>
    >>
    >> Add nested if then else loops to choose directory etc.
    >>
    >> Or you could use the case statement
    >> --
    >>
    >> Rob
    >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    >> http://aspir8or.googlepages.com/blog

    >
    > Damn! This script actually makes sense......
    >
    > Think I'm gonna have to build a 'nix box (finally...) to play: so- given I'm
    > a 'nux noob, (and a Win superuser - c.f. an alpha or beta geek ;-)
    > -what distro would be suggested?
    >
    > -am looking for something easy to learn and able to be run on a basic
    > box -say PIII/500, 256 MB RAM and generic video-oh, with as much as possible
    > configurable via a GUI.
    > Will get more adventurous once I have *some* knowledge <smile>
    > TIA for any info -and Wodger <aka M. Good> need not apply...
    > Thanks,
    > -Darl [Pleb}
    >
    >

    For older hardware, I'd look at Puppy or Damnsmalllinux, both of which
    have a very small footprint and also come as live cds, so you can try
    them out without installing to hard disk. www.distrowatch.com is a good
    place to start, with reviews of just about every distribution out.

    You could probably run Ubuntu on that hardware, but it would be a bit
    slow. Unfortunately Linux nowadays suffers from bloat just as much as
    Windows, with distros like Sabayon and Suse running to >3 Gb. With that
    though you get 3d eyecandy via xgl/compiz or beryl, but hardware
    requirements are pretty stiff.

    --

    Rob
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    http://aspir8or.googlepages.com/blog
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
    Rob S, Jan 7, 2007
    #5
  6. Robert Cooze

    Peter Guest

    Pleb Plebian wrote:
    > Think I'm gonna have to build a 'nix box (finally...) to play: so- given
    > I'm a 'nux noob, (and a Win superuser - c.f. an alpha or beta geek ;-)
    > -what distro would be suggested?
    > -am looking for something easy to learn and able to be run on a basic
    > box -say PIII/500, 256 MB RAM and generic video-oh, with as much as
    > possible configurable via a GUI.


    That hardware is kinda limited, so it won't run the latest Linux distros
    very well. You can get Linux configured and optimised to run on such
    hardware, but this isn't an easy way to start (try the Gentoo distro, it is
    very much do it yourself, but has good documentation and support).

    Otherwise, look for a distro that is built to run on limited hardware, such
    as Xubuntu (www.xubuntu.org), or check out this page ...
    http://wiki.linux.net.nz/SelectingADistribution

    Most distros come with a live CD, ie it boots and runs completely off the
    CD, so you don't need to disturb anything on your hard disk. Knoppix was
    the first of the mainstream live CDs, but there is now also Ubuntu,
    Mandriva and others.

    But remember, Linux is very different to Windows. There is a lot to learn,
    but with patience it can be done. If nothing else, you will get an
    enhanced understanding of Windows and of computers in general. There is
    lots of support around, but you should read this first ...
    http://www.catb.org/~esr/faqs/smart-questions.html

    HTH

    Peter
     
    Peter, Jan 7, 2007
    #6
  7. Robert Cooze

    Robert Cooze Guest

    Mathew Good wrote:
    > On Sun, 07 Jan 2007 11:25:32 +1300, Robert Cooze <> wrote:
    >
    >> Now I am using linux but could apply to windows I guess. I do a lot of
    >> recording of lp's and tapes wich I edit and want to batch convert to MP3.
    >>
    >> Been googling and came accross these jems
    >>
    >> ls -1 *.mp3 | sed "s/\(.*\)\.mp3/\1.mp3 \1_128.mp3/" |xargs -n 2 lame -h
    >>
    >> a down sample command and edited it to
    >>
    >> ls -1 *.wav | sed "s/\(.*\)\.wav/\1.wav \1_vbr.mp3/" |xargs -n 2 lame
    >> --preset standard
    >>
    >> and
    >>
    >> ls -1 *.wav | sed "s/\(.*\)\.wav/\1.wav \1_128.mp3/" |xargs -n 2 lame -h
    >>
    >> these work good!
    >>
    >> but found a bash script to do more or less of the same
    >>
    >> #!/bin/bash
    >>
    >> clear
    >> echo
    >> echo autolame V 0.12
    >> echo
    >> echo "autolame was written by Lawrence Shafer"
    >> echo "Please send any flames, laughter hugs and"
    >> echo "updates/enhancements to lawrence(at)pastimes.cc"
    >> sleep 5
    >>
    >> # Usage Instructions.
    >>
    >> # 0 make sure you have lame installed!
    >> # 1 Copy this file to /usr/bin/autolame.
    >> # 2 cd to the directory where the wav's are that you want to convert.
    >> # 3 type autolame
    >> # 4 they're done!
    >>
    >> # need to ad arg for lame command line and for in/out filenames so you
    >> dont have to run it in the wav folder
    >>
    >> # Get all files in current directory
    >> myWavFiles=$(ls *.wav)
    >>
    >> # Go through the wav's and convert them
    >> for oldWav in $myWavFiles
    >>
    >> do
    >>
    >> clear
    >> echo
    >> echo auto-lame V 0.12
    >> echo
    >> # Get original filename without .Wav extension
    >> originName=$(echo $oldWav|awk '{sub(".wav"," ");print $1}');
    >> echo $originName
    >> echo
    >>
    >> # Create the new filename including .mp3
    >> newMp3=$originName".mp3"
    >>
    >> echo "Encoding $oldWav to $newMp3";
    >> echo
    >> echo
    >> # Convert it
    >> lameit=$(lame -h $oldWav $newMp3);
    >> done
    >>
    >>
    >> I haven't tested it but how easy would it be to make the bash script
    >> interactive so It could to the wave to mp3 and mp3 to mp3 downsample and
    >> or change the quality would also like to put the output into a different
    >> directory
    >>
    >> I sort of get the way the switches work I ain't a programmer by any
    >> stretch of the imagination pointers and advice would be much appreciated
    >>
    >> now I know I could proberly get a all sining and dancing program with
    >> gut to boot but this is something for fun

    >
    >
    >
    > Why not Spend some money are get a REAL Program not that stuff that is out of the Ark..
    >
    >

    quite simply I have spent a lot of money on windows software too much!!!

    --
    http://cooze.co.nz home of the RecyclerMan aka Robert Cooze

    / __/ / / / / /__ / / ___/ / __/ / / / |/ / /__ /
    / / / /_/ / / /_/ / _-' / __/ / / / /_/ / / /| / _-'
    ___\ ____/ ____/ /___/ /____/ /_/ ___\ ____/ /_/ /_/ |_/ /___/
     
    Robert Cooze, Jan 7, 2007
    #7
  8. Robert Cooze

    Robert Cooze Guest

    Rob S wrote:
    > #!/bin/bash
    > echo "Choose a menu number"
    > echo "1. Wav to mp3"
    > echo "2. Mp3 to wav"
    > echo "3. Mp3 to mp3 downsample"
    > read word
    > if [ "$word" = "1" ]; then
    > lame ....
    > elif [ "$word" = "2" ]; then
    > lame -decode ....
    > elif [ "$word" = "3" ]; then
    > lame ....
    > else
    > echo "Unable to parse your answer"
    > exit
    > fi
    >
    >
    > Add nested if then else loops to choose directory etc.
    >
    > Or you could use the case statement


    Thanks for that I can see how it works and now think I can do a little
    re jigging of the script and make it work as I want.

    --
    http://cooze.co.nz home of the RecyclerMan aka Robert Cooze

    / __/ / / / / /__ / / ___/ / __/ / / / |/ / /__ /
    / / / /_/ / / /_/ / _-' / __/ / / / /_/ / / /| / _-'
    ___\ ____/ ____/ /___/ /____/ /_/ ___\ ____/ /_/ /_/ |_/ /___/
     
    Robert Cooze, Jan 7, 2007
    #8
  9. Robert Cooze

    Mathew Good Guest

    On Sun, 7 Jan 2007 18:17:06 +1300, "Pleb Plebian" <> wrote:

    >
    >"Rob S" <Here@home> wrote in message news:45a05baf$...
    >> #!/bin/bash
    >> echo "Choose a menu number"
    >> echo "1. Wav to mp3"
    >> echo "2. Mp3 to wav"
    >> echo "3. Mp3 to mp3 downsample"
    >> read word
    >> if [ "$word" = "1" ]; then
    >> lame ....
    >> elif [ "$word" = "2" ]; then
    >> lame -decode ....
    >> elif [ "$word" = "3" ]; then
    >> lame ....
    >> else
    >> echo "Unable to parse your answer"
    >> exit
    >> fi
    >>
    >>
    >> Add nested if then else loops to choose directory etc.
    >>
    >> Or you could use the case statement
    >> --
    >>
    >> Rob
    >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    >> http://aspir8or.googlepages.com/blog

    >
    >Damn! This script actually makes sense......
    >
    >Think I'm gonna have to build a 'nix box (finally...) to play: so- given I'm
    >a 'nux noob, (and a Win superuser - c.f. an alpha or beta geek ;-)
    >-what distro would be suggested?
    >
    >-am looking for something easy to learn and able to be run on a basic
    >box -say PIII/500, 256 MB RAM and generic video-oh, with as much as possible
    >configurable via a GUI.
    >Will get more adventurous once I have *some* knowledge <smile>
    >TIA for any info -and Wodger <aka M. Good> need not apply...
    >Thanks,
    >-Darl [Pleb}
    >



    Maybe you should just leave this grup alown..
     
    Mathew Good, Jan 7, 2007
    #9
  10. Robert Cooze

    Rob S Guest

    Robert Cooze wrote:
    > Rob S wrote:
    >> #!/bin/bash
    >> echo "Choose a menu number"
    >> echo "1. Wav to mp3"
    >> echo "2. Mp3 to wav"
    >> echo "3. Mp3 to mp3 downsample"
    >> read word
    >> if [ "$word" = "1" ]; then
    >> lame ....
    >> elif [ "$word" = "2" ]; then
    >> lame -decode ....
    >> elif [ "$word" = "3" ]; then
    >> lame ....
    >> else
    >> echo "Unable to parse your answer"
    >> exit
    >> fi
    >>
    >>
    >> Add nested if then else loops to choose directory etc.
    >>
    >> Or you could use the case statement

    >
    > Thanks for that I can see how it works and now think I can do a little
    > re jigging of the script and make it work as I want.
    >

    This is just a basic loop. To save in a different directory, after each
    if/elif, add another loop asking for directory path

    echo "Enter full path to save directory eg. /home/username/music/zappa"
    read save_dir
    cd $save_dir
    lame ...

    same with sampling rate
    echo "Enter sample rate"
    read smp_r
    lame --bitrate $smp_r

    I'm not up on all the lame switches, but man lame will get you there.

    Another way is to use the "case" statement to create a menu and derive
    variables


    And for woger, there is nothing wrong with shell scripts for this sort
    of work. Why pay $ for something that takes a few minutes to write? And
    a hell of a lot of the programs you buy have simple loops built in to
    handle this stuff anyway.
    Rob
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    http://aspir8or.googlepages.com/blog
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



    This is Unix and Netware country, on a quiet night you can hear NT Reboot.
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     
    Rob S, Jan 7, 2007
    #10
  11. Robert Cooze

    Pleb Plebian Guest

    Thanks guys: looks like I'll give Xubuntu a go

    Appreciate the help,
    Cheers
    -Darl
     
    Pleb Plebian, Jan 8, 2007
    #11
  12. Robert Cooze

    jasen Guest

    On 2007-01-07, Rob S <Here@home> wrote:


    > You could probably run Ubuntu on that hardware, but it would be a bit
    > slow. Unfortunately Linux nowadays suffers from bloat just as much as
    > Windows, with distros like Sabayon and Suse running to >3 Gb.


    3G is tiny, Debian is more than 9Gb, much of it is stuff you'll never need.
    so don't download it all....

    Bye.
    Jasen
     
    jasen, Jan 8, 2007
    #12
  13. Robert Cooze

    Robert Cooze Guest

    Rob S wrote:
    > Robert Cooze wrote:
    >> Rob S wrote:
    >>> #!/bin/bash
    >>> echo "Choose a menu number"
    >>> echo "1. Wav to mp3"
    >>> echo "2. Mp3 to wav"
    >>> echo "3. Mp3 to mp3 downsample"
    >>> read word
    >>> if [ "$word" = "1" ]; then
    >>> lame ....
    >>> elif [ "$word" = "2" ]; then
    >>> lame -decode ....
    >>> elif [ "$word" = "3" ]; then
    >>> lame ....
    >>> else
    >>> echo "Unable to parse your answer"
    >>> exit
    >>> fi
    >>>
    >>>
    >>> Add nested if then else loops to choose directory etc.
    >>>
    >>> Or you could use the case statement

    >>
    >> Thanks for that I can see how it works and now think I can do a little
    >> re jigging of the script and make it work as I want.
    >>

    > This is just a basic loop. To save in a different directory, after each
    > if/elif, add another loop asking for directory path
    >
    > echo "Enter full path to save directory eg. /home/username/music/zappa"
    > read save_dir
    > cd $save_dir
    > lame ...
    >
    > same with sampling rate
    > echo "Enter sample rate"
    > read smp_r
    > lame --bitrate $smp_r
    >
    > I'm not up on all the lame switches, but man lame will get you there.
    >
    > Another way is to use the "case" statement to create a menu and derive
    > variables
    >
    >
    > And for woger, there is nothing wrong with shell scripts for this sort
    > of work. Why pay $ for something that takes a few minutes to write? And
    > a hell of a lot of the programs you buy have simple loops built in to
    > handle this stuff anyway.
    > Rob
    > - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    > http://aspir8or.googlepages.com/blog
    > - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    >
    >
    >
    > This is Unix and Netware country, on a quiet night you can hear NT Reboot.
    > - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    I have been a long time lame user I have found it better in command
    format than in GUI for the job I am doing. I have had up to 20 gig of
    wav files produced from my turntable one shell script would make the job
    much easer!

    Now I am back to work:( Things take time so I will have a play and see
    what I come up with.

    --
    http://cooze.co.nz home of the RecyclerMan aka Robert Cooze

    / __/ / / / / /__ / / ___/ / __/ / / / |/ / /__ /
    / / / /_/ / / /_/ / _-' / __/ / / / /_/ / / /| / _-'
    ___\ ____/ ____/ /___/ /____/ /_/ ___\ ____/ /_/ /_/ |_/ /___/
     
    Robert Cooze, Jan 8, 2007
    #13
  14. In message <45a024ff$>, Robert Cooze wrote:

    > Now I am using linux but could apply to windows I guess. I do a lot of
    > recording of lp's and tapes wich I edit and want to batch convert to MP3.
    >
    > Been googling and came accross these jems
    >
    > ls -1 *.mp3 | sed "s/\(.*\)\.mp3/\1.mp3 \1_128.mp3/" |xargs -n 2 lame -h


    Can be expressed more concisely as

    for f in *.mp3; do lame -h $f ${f%.mp3}_128.mp3; done

    I'll leave the corresponding simplifications of the others as an exercise
    for the reader. :)
     
    Lawrence D'Oliveiro, Jan 9, 2007
    #14
  15. In message <45a024ff$>, Robert Cooze wrote:

    > originName=$(echo $oldWav|awk '{sub(".wav"," ");print $1}');


    More simply written as

    originName=${oldWav%.wav}

    > lameit=$(lame -h $oldWav $newMp3);


    Don't know why this isn't just written as

    lame -h $oldWav $newMp3

    > ... would also like to put the output into a different directory


    Simple, just replace the above lame call with, for example

    DstDir=../mp3s
    lame -h $oldWav $DstDir/$newMp3

    (For added flavour, you could prompt the user to enter the value for
    DstDir.)

    > I sort of get the way the switches work ...


    At some point, it helps to read documentation.
     
    Lawrence D'Oliveiro, Jan 9, 2007
    #15
  16. Robert Cooze

    Robert Cooze Guest

    Lawrence D'Oliveiro wrote:
    > In message <45a024ff$>, Robert Cooze wrote:
    >
    >> Now I am using linux but could apply to windows I guess. I do a lot of
    >> recording of lp's and tapes wich I edit and want to batch convert to MP3.
    >>
    >> Been googling and came accross these jems
    >>
    >> ls -1 *.mp3 | sed "s/\(.*\)\.mp3/\1.mp3 \1_128.mp3/" |xargs -n 2 lame -h

    >
    > Can be expressed more concisely as
    >
    > for f in *.mp3; do lame -h $f ${f%.mp3}_128.mp3; done
    >
    > I'll leave the corresponding simplifications of the others as an exercise
    > for the reader. :)
    >

    Yes I know there are many ways of doing the same thing:) time to get
    busy and play and read! then I will Know why, when & how. the original
    job is done and dusted now I am looking at the prervibal 9 ways to skin
    a cat.

    --
    http://cooze.co.nz home of the RecyclerMan aka Robert Cooze

    / __/ / / / / /__ / / ___/ / __/ / / / |/ / /__ /
    / / / /_/ / / /_/ / _-' / __/ / / / /_/ / / /| / _-'
    ___\ ____/ ____/ /___/ /____/ /_/ ___\ ____/ /_/ /_/ |_/ /___/
     
    Robert Cooze, Jan 9, 2007
    #16
  17. In message <45a3d285$>, Robert Cooze wrote:

    > Lawrence D'Oliveiro wrote:
    >
    >> In message <45a024ff$>, Robert Cooze wrote:
    >>
    >>> Now I am using linux but could apply to windows I guess. I do a lot of
    >>> recording of lp's and tapes wich I edit and want to batch convert to
    >>> MP3.
    >>>
    >>> Been googling and came accross these jems
    >>>
    >>> ls -1 *.mp3 | sed "s/\(.*\)\.mp3/\1.mp3 \1_128.mp3/" |xargs -n 2 lame -h

    >>
    >> Can be expressed more concisely as
    >>
    >> for f in *.mp3; do lame -h $f ${f%.mp3}_128.mp3; done
    >>

    > Yes I know there are many ways of doing the same thing:) time to get
    > busy and play and read! then I will Know why, when & how.


    Good on you--by all means do that. Then you can understand how the original
    example creates 3 additional processes to get the job done, that my version
    does not.
     
    Lawrence D'Oliveiro, Jan 11, 2007
    #17
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc
    Replies:
    22
    Views:
    1,039
    Senti
    Jan 22, 2004
  2. Ramon F Herrera

    What sound format and sampling to use?

    Ramon F Herrera, Jul 7, 2005, in forum: VOIP
    Replies:
    2
    Views:
    6,964
    Morten Reistad
    Jul 21, 2005
  3. Scott W

    Down sampling and Nyquist limits

    Scott W, Nov 1, 2006, in forum: Digital Photography
    Replies:
    20
    Views:
    2,595
    Bart van der Wolf
    Nov 5, 2006
  4. Muze Groops

    .aac .wma pro or LAME mp3?

    Muze Groops, Jul 6, 2007, in forum: Computer Support
    Replies:
    1
    Views:
    1,029
    Mitch
    Jul 7, 2007
  5. Mews Grewps

    Do all mp3 players support LAME VBR?

    Mews Grewps, Sep 28, 2007, in forum: Computer Support
    Replies:
    2
    Views:
    612
    Plato
    Oct 7, 2007
Loading...

Share This Page