# How do I calculate the SNR of a noisy signal without having the noise?

I wish to calculate the signal-to-noise ratio (SNR) of a speech signal in MATLAB. I only have the speech signal, and the speech-in-noise, but I don't have the noise file alone. How do I calculate the SNR of the speech in noise?

• If you have $s + n$ and $s$, then you can just subtract to get $n$, then find the power ratio. If the two signals aren't synchronized with one another, then it's a bit tougher. You can approximate the noise power by assuming that the noise is orthogonal to your speech signal (in the stochastic sense), so its power just adds to the signal power. – Jason R Jan 29 '16 at 19:34

If the noise is additive, and your signals are in sync (i.e. same number of samples, and temporal aligned). You need to subtract your original signal from your Noisy signal - which will give you the additive noise. You can then calculate the power of this and compare it to the clean version of your signal to compute the SNR

In Matlab this should just be:

Noise = NoisySignal - OriginalSignal; %//Should give a vector or Matrix depending on what stereo or mono.
SNR = snr(OriginalSignal,Noise) %// should give the single SNR reading in dB.

• However, in a case where the signals are not in sync, it becomes much harder, and in general, we consider it a mix of different elements that could have caused the distortion (or lose in sync), and usually a combination of SAR (Signal to Artefact Ratio), SIR (Signal to Interference Ratio) and SDR (Signal to Distortion Ratio) are used instead. The SIR is very similar to SNR in this case.

I use alway the wikipedia alternative definition
here is $$SNR = \frac{\mu}{\sigma} = \frac{\text{mean}}{\text{Standard deviation}}$$ I choose the arithmetic mean what is $$\mu = \frac{1}{N} \sum_{n=0}^{N} (x_1 + x_2 + \ldots x_N)$$ and the Standard deviation is $$\sigma = \sqrt{\frac{1}{N} \sum_{i=0}^{N} (x_i - \mu)^2 }$$

• Note the caveat on the page you linked: Notice that such an alternative definition is only useful for variables that are always non-negative (such as photon counts and luminance). – Jason R Jan 30 '16 at 14:01
• So not for audio etc?? In that case i have the same question... – Jan-Bert Jan 30 '16 at 15:33