The different directory part is easy - just specify a directory in the output filename.
i.e. sox old/song_one.mp3 -r 128 new/song_one.mp3 As for overwriting, that depends on the implementation of sox, and I don't know if that's a feature. On Mon, Jun 27, 2011 at 8:36 AM, mopman <[email protected]> wrote: > Hey Daniel, > > Sorry it took me so long to reply. > > Thanks for the one-liner. It worked (sort of). I didn't realize that > the files had different sampling rates. This can be changed too > without much hassle with sox, but I found that my version wasn't > compiled to encode mp3's. I then tried to recompile with MP3 support, > but for some reason "configure" couldn't register the libraries. > > So I thought "what the heck" and upgraded to 11.04 (I have wanted to > do it in any case for a while already). Haven't had time to check if > the version of sox that ships with it will work. > > Perhaps you could help me with this as well: > > is there a way for me to tell sox to save newly created files in a > different directory or to force it to overwrite the existing ones? the > arguments are > > sox [input file] -r [new sampling rate] [output file] > > Thank you. > > > On Jun 6, 4:18 pm, Daniel Eggleston <[email protected]> wrote: > > Without knowing details, here's a quick & dirty method: > > > > ls | cut -d '_' -f 1 | sort | uniq | xargs -i sox [args here] {}_ru {}_af > > {}_output > > > > This makes a few assumptions: > > - None of the files have an underscore besides the delimiter before the > > suffix. > > - All of the files in your directory are *_{ru|af}. > > - All *_ru files have a complementary *_af file > > - You know what args to pass to sox (because I don't). > > > > > > > > > > > > > > > > > > > > On Mon, Jun 6, 2011 at 5:46 AM, mopman <[email protected]> wrote: > > > Ubuntu 10.10 64 bit > > > BASH shell > > > > > I'm trying to concatenate a list of audio files. > > > > > The files all look as follows: > > > > > file1_af > > > file1_ru > > > file2_af > > > file2_ru > > > > > In all cases I need to add the "_ru" file to the end of the "_af" > > > file. What I need is a script that would match all prefixes in the > > > directory and then concatenate them (_ru has to be after _af in all > > > cases). It seems that sox will be the best program to use to combine > > > the audio files, but I cannot for the life of me write a proper script > > > to match the files. > > > > > I thought of using regular expressions, but I think I will probably > > > be adding to my misery if I do that. > > > > > Any help would be appreciated, even if you just point me in the right > > > direction. > > > > > Thank you. > > > > > -- > > > You received this message because you are subscribed to the Linux Users > > > Group. > > > To post a message, send email to [email protected] > > > To unsubscribe, send email to > [email protected] > > > For more options, visit our group at > > >http://groups.google.com/group/linuxusersgroup > > > Please remember to abide by our list rules ( > http://tinyurl.com/LUG-Rulesor > > >http://cdn.fsdev.net/List-Rules.pdf) > > > > -- > > > > Daniel > > -- > You received this message because you are subscribed to the Linux Users > Group. > To post a message, send email to [email protected] > To unsubscribe, send email to [email protected] > For more options, visit our group at > http://groups.google.com/group/linuxusersgroup > Please remember to abide by our list rules (http://tinyurl.com/LUG-Rulesor > http://cdn.fsdev.net/List-Rules.pdf) > -- Daniel -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or http://cdn.fsdev.net/List-Rules.pdf)
