I am writing a bash script that mixes audio files for a Speech Recognition task. Following is the folder structure:
-folder1
-- file1.wav
-- file2.wav
-- file3.wav
-folder2
-- noise1.wav
-- noise2.wav
-- noise3.wav
What my code is doing right now is combining file1.wav with all the .wav files in folder 2. Then file2.wav with all the wav files in folder2. What I want is to combine file1.wav with noise1.wav. Then increment both the loops and combine file2.wav with noise2.wav.
I don't know how to increment the filename variable in the for loop. Following is my code:
#!/bin/sh
number=0 #initialize number
for f1 in selected/*/wav/*; do
for f2 in backgroundnoise/output/*; do
sox -m $f1 $f2 output/{$number}.wav
number=$((number+1))
done
done