3
$\begingroup$

I'm a beginner in audio signal processing, and I'm trying to figure out how to compute the signal-to-noise (SNR) ratio from 2 audio clips.

I have two single-channel audio clips, where one is a recording of room noise(/ambient noise) and another one is a recording of human speech in that room. I find a few equations that use decibels(dB) in computing SNR, but I don't have the information such as decibel or microphone details such as watt or voltage. Is it possible to compute the signal-to-noise ratio from these 2 audio clips alone?

Thank you!!

$\endgroup$
1
  • $\begingroup$ I think the signal level is highest desired signal in each clips. the noise level is the lowest valid level in each clips. by deviding each in each clips, you will achieve SNR of the specified clip. And if you want it in decibel then you need to convert it to decibel. $\endgroup$ Jun 25, 2022 at 11:47

2 Answers 2

3
$\begingroup$

In the first case, $x_1$, your recording contains only what you consider the noise component, the power of which, $P_1$, can be estimated by: $$N = P_1 = \frac{1}{M_1}\sum_{m=1}^{M_1}\left[x_1(m)\right]^2$$ where $M_1$ is the number of samples in the first recording.

In the second case, $x_2$, the recording is (what is assumed to be) the same background noise plus the desired signal. Here we can estimate the combined noise plus signal power, $P_2$, (under the assumption they are uncorrelated): $$S+N = P_2 = \frac{1}{M_2}\sum_{m=1}^{M_2}\left[x_2(m)\right]^2$$ where $M_2$ is the number of samples in the second recording.

The estimated signal-to-noise ratio is then the ratio of the estimated signal power to the estimated noise power. Unfortunately we don't directly have the signal power but can estimate it by subtracting the noise power estimate from the combined signal plus noise estimate: $$SNR = \frac{S}{N} = \frac{S+N-N}{N} = \frac{P_2 - P_1}{P_1} = \frac{P_2}{P_1} - 1$$

This is a reasonable estimate when the signal is reasonably larger than the noise level. When the signal level is small you need to check that the ratio of the estimate does not go below zero.

If you want the SNR in decibels use the following (factor of 10 as this is power): $$SNR_{dB} = 10\log_{10}\frac{S}{N}$$

$\endgroup$
2
$\begingroup$

Is it possible to compute the signal-to-noise ratio from these 2 audio clips alone?

Maybe.

In order to calculate SNR, the signals must have the same calibration or scaling. Verifying or calculating the scaling will require information on how the recordings where done: microphone type and sensitivity, pre-amp gain, A/D gain, any type of scaling or normalization done by the recording software, etc. That tends be very tricky so in most cases you will need the recordings to be either done with the exact same setup or contain an actual calibration signal.

Next you need to determine how "clean" the speech recording is. Is the "no noise", "same noise" or "different noise" from the noise-only recording. You can calculate SNR for "no noise" (which is easy), from "same noise" (if it's in a suitable range) but not for "different noise". "Same" doesn't require the exact same recording but the same general noise type (HVAC, traffic, background music, concurrent talker, etc) and the same level.

Finally you need to decide on how to handle frequency and time. Audio SNR often varies with time and varies A LOT with frequency. If your noise and speech are reasonable stationary, you can process the entire recording for a single SNR. If the noise varies a lot, you may have to chop the recordings up into smaller stationary sections and you need end up with SNR as a function of time. That depends a bit on your specific application and what exactly you are planning to do with the SNR.

Frequency dependencies is typically handled by applying a frequency weighting filter that models what frequencies are most relevant to human auditory perception. The most common is the so-called "A weighting". See for example https://en.wikipedia.org/wiki/A-weighting

In conclusions: if your signals are scaled identically, if the noise is stationary, AND if the speech signal is noise free, you can calculate the SNR simply as

$$SNR = 10 \log_{10}\frac{\sum s_A^2[k]^2}{\sum n_A^2[k]}$$

where $s_A[k]$ is your A-weighted noise free speech signal and $n_A[k]$ your A-weighted noise signal.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.