4

I would like to ADD noise to audio files. Is there a way to accomplish this in SoX (or other tool)?

I am performing machine learning research, and need to test my algorithms in the presence of noise. Ideally, I would like to specify a signal to noise ratio and have noise added to reach that target SNR.

I know that I could generate a noise file and subsequently mix it with each of my source files. As I need to do this in a batch mode over thousands of files, I seek simpler more elegant method.

Any ideas or suggestions most welcome. Thank you.

donnpat
  • 41
  • 1
  • 3

2 Answers2

3

I came across the same problem and found this website particularly useful:

http://linguistics.berkeley.edu/plab/guestwiki/index.php?title=Sox_in_phonetic_research#Add_noise_to_an_audio_file

Cassandra
  • 31
  • 4
2

Piping outputs gave me error. Instead, just write the noise on a file and then do the mixing:

sox input.wav noise.wav synth whitenoise vol 0.02 && sox -m input.wav noise.wav noisyinput.wav

Yusuf Tarık Günaydın
  • 3,016
  • 2
  • 27
  • 41