I have an audio file. I took an extract of the file called variable "CALL", and I took another extract from the file which is just filled with background noise, called "BACKGROUND". Using matlab, I found the signal to noise ratio of CALL using: snr(CALL,BACKGROUND); % both variables are of the same length

the signal to noise outputted was 5.3949

I want to add noise to CALL, and lower this signal to noise to 3 for example. How would I go about programming this?

I've only seen examples where people add noise to a perfect signal (i.e. they just create some kind of sinewave, then add noise to that), I have a signal which already has noise, and I want to add more noise, and know its signal to noise value.

Also, is the above method for how I found my first signal to noise value correct? (I'm assuming the background noise is somewhat constant throughout the audio file)

maybe the info at the following web page will be of some use to you. http://www.dsprelated.com/showcode/263.php [-Rick-]

• I believe I have seen this before but the issue is that this is about adding noise to a noise free signal, whereas I want to add noise to an already noisy signal (Assuming I knew the original signal to noise, I don't know how to account for the existing snr when calculating the new one, or how to create this new snr) May 14 '15 at 5:53

It looks like you have calculated $$\frac{S+N}{N}=3.47$$ (The output of snr is in dB). This means that $\frac{S}{N}=2.47$. I have assumed that the power of the signal plus noise is equal to the power of the signal plus the power of the noise, which is not unreasonable since the two are probably uncorrelated.

To have SNR=3, the noise power needs to be $N_1=2.47N/3=0.82N$. This can't be done because you can't reduce the noise.

To have SNR=2 (3 dB), the noise power needs to be $N_1=2.47N/2=1.235N$. The power of your signal BACKGROUND is $N$. Then, generate a new noise signal of power $0.235N$ and add it to CALL. That should make your SNR=2.

• Yes. After looking at the snr(...) command documentation, it seems they use a pure (no noise) signal, and background noise as their arguments. Assuming my background noise is similar to the background noise in the CALL I did snr(CALL - BACKGROUND,BACKGROUND); giving 6.4762 (not sure where your 3.47 came from but I understood your math. The two N's are similar but not the same). Also, wont that add more energy to my audio? I essentially want to create audio as if the signal was quieter but the background values were the same May 14 '15 at 5:51
• @CaptainObv The 3.47 comes from converting 5.3949 from decibels to normal scale ($10^{0.54}=3.47$). Make sure you don't mix decibels and non-decibels in your calculations.
– MBaz
May 14 '15 at 14:41
• @CaptainObv The only thing you can do to your signal is add more noise. You can't reduce the noise because you don't know what the noise is. Now, adding noise and then normalizing the volume should, I think, be pretty similar to reducing the signal power while keeping the noise power constant (assuming you add noise with the same spectral and statistical properties as the original noise).
– MBaz
May 14 '15 at 14:43
• It feels like my problems would be so much easier to deal with if I could get rid of the noise in my original CALL. Then I can just add varying amounts of noise to specified values. If I create a STFT spectrogram of the CALL, the bit that is of interest to me, is between 25-35kHz. Majority of the noise is in other frequencies. Is it ideal for me to perform a bandpass filter to obtain a pure-ish CALL, and then add the BACKGROUND to the clean CALL and normalize it? May 14 '15 at 16:13
• @CaptainObv Filtering will certainly help, by removing all noise outside your band. It won't remove any of the noise in your band of interest, though.
– MBaz
May 14 '15 at 16:26