Script to automatically merge 2 wav files in 1 mp3 file
hello,
I'm not entirely new to Linux, but I am new to scripting in Bash. Can anybody help me with the following: Short Question: How can I automatically merge 2 wav-files into 1 mp3 file? Explanation: I play in a band and last saturday night we recorded some of our songs on a simple digital recording device. This device create two wav-files, 1 for the frontmicrophone and 1 for the backmicrophone. I want to merge these files together, but since we recorded a lot of things, we got a lot of files to merge. I don't want to do all that work by hand. :) Now I want to save the files in 1 directory, and I want to create a script which search for a particular pattern in a file name (eg. "MC0001F.wav" and "MC0001B.wav" so the script must search for "*F.wav" and "*B.wav"). When he found a match, he must merge those files into 1 mp3 (I guess I can use something like 'sox' for that). Can anybody help me with this? Thanks in advance. Jackuss |
Assuming you want to process the current directory, and that the filenames are as you gave, identical except for F.wav/B.wav, something like this should work:
Code:
for f_file in ./*F.wav; do |
<problem solved>
David The H.
Thanks for your reply, I tried it and it worked for me. For the record, This is what I did to make it work: Code:
for f_file in ./*F.wav; do Thanks again. Regards, Jackuss |
Glad to hear it. Incidentally, you can use a similar parameter substitution to strip the original .wav extension off the name, before adding the .mp3.
Code:
soxmix $f_file $b_file -r 44100 /media/58E5-6EB7/mp3/${b_file%.wav}.mp3 |
In case you want to do a really good job in terms of start finish, sync, fading, volume, etc. then Ardour is really good, but with a steep learning curve if you are not used to mixing.
|
Quote:
I already use Ardour and it is indeed a great program, with some rough edges unfortunately. The reason I wanted to create a script is that, last Saturday we recorded all our songs on an simple recording device (The "Zoom H 2" if you are interested), and recorded about 10 - 15 songs. We didn't want to mix it, just record so we could practice. You can understand that I didn't want to manually import all the the *F.wav and *R.wav files, and then export them with a program like Ardour or Audacity. When we want to mix our music, I think we are going to record on a multi-tracker. That way I can select all the instruments apart and mix them appropriately. Thanks again. |
All times are GMT -5. The time now is 05:11 PM. |