I'm trying to add white noise to hundreds of files. I find a command but don't know how to adapt it. There is a source folder with files and an empty destination folder. Could someone help me with the right command? I'm using OSX.
You should put the command in a for
loop, then refer to the for
variable as file name.
I assume that the source folder and the destination folder are on the same level.
for file in *.wav; do sox "$file" -p synth whitenoise vol 0.02 | sox -m "$file" - "../DESTINATION/$file"; done
In addition, if you want to use a suffix in the name of the output files, use basename
to exclude the extension:
for file in *.wav; do sox "$file" -p synth whitenoise vol 0.02 | sox -m "$file" - "../DESTINATION/$(basename $file)_output.wav"; done