I’m a noob trying to write a script that does three things:
Take a series of pre-numbered MP3 files and convert them to WAV files using sox.
Cat the wav files together into several larger wav files based on user input on total number of parts and number of files for each part
Convert the larger wav files to M4A files using faac.
I’ve got the first part down. The second part is proving more tricky. If I have, say, 50 wav files that I want to turn into 5 wav files, I have a dialog that asks how many files there should be total, then dialogs asking for the number of files in each part. If the first part is going to have 10 files, I need my script to pass arguments to sox (i.e. sox 01.wav 02.wav … 10.wav part1.wav). I’m currently trying to use a for loop to append the numbers to a file, then use that file to pass the variables to sox. I can’t seem to figure out how to concatenate the numbers to the file without each number being on a new line. I know there is a TCL command called “append” which seems like it would do what I need, but it can’t be called from a bash script.
I hope I’m being clear enough to elicit some ideas from people who are much more knowledgeable about scripting than I. Thanks for your thoughts.
unset MYVAR;for i in seq 0 9; do MYVAR="$MYVAR $i.wav"; done; echo $MYVAR
Good luck.
chriscrutch wrote:
> I’m a noob trying to write a script that does three things:
>
> 1. Take a series of pre-numbered MP3 files and convert them to WAV
> files using sox.
> 2. Cat the wav files together into several larger wav files based on
> user input on total number of parts and number of files for each part
> 3. Convert the larger wav files to M4A files using faac.
>
> I’ve got the first part down. The second part is proving more tricky.
> If I have, say, 50 wav files that I want to turn into 5 wav files, I
> have a dialog that asks how many files there should be total, then
> dialogs asking for the number of files in each part. If the first part
> is going to have 10 files, I need my script to pass arguments to sox
> (i.e. sox 01.wav 02.wav … 10.wav part1.wav). I’m currently trying to
> use a for loop to append the numbers to a file, then use that file to
> pass the variables to sox. I can’t seem to figure out how to
> concatenate the numbers to the file without each number being on a new
> line. I know there is a TCL command called “append” which seems like it
> would do what I need, but it can’t be called from a bash script.
>
> I hope I’m being clear enough to elicit some ideas from people who are
> much more knowledgeable about scripting than I. Thanks for your
> thoughts.
>
> --chriscrutch
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
chriscrutch wrote:
> Beautiful. Script works well after using your code and finishing the
> rest of it. Thank you.
>
> --chriscrutch
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/