How can I add noise to a recording to obtain a SNR value provided by the user? I am tryin to test the effects of noise on my algorithm. Is there any function or app for doing that kind of task?
Thank you.
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.
Sign up to join this communityHow can I add noise to a recording to obtain a SNR value provided by the user? I am tryin to test the effects of noise on my algorithm. Is there any function or app for doing that kind of task?
Thank you.
Easiest way is to scale energy of noise. Nevertheless you must understand that for some files it is not that simple. Let's say that you have the recording of crying baby in silence. What is then your point of reference? Are you going to add white noise based on ratio between it's energy and average energy across the whole recording (silence+baby)? Or maybe you should calculate the energy in sliding window and then use only sound of interest as point of reference? That is why you should not add noise based on energy of your whole file.
When it comes to some particular examples, then I suggest you to take a look here for mathematical derivation. If you are looking for functions, then please check out the MATLAB awgn function. Nevertheless if you want something even more sophisticated, then you might want to check the Audio Degradation Toolbox. You can find a dedicated routine for adding various types of noise with a given SNR.