# Calculating the SNR of Audio Signal (Recommended Libraries)

Are there any open source packages or libraries available which can be useful in calculating the SNR(signal to noise ratio) of an audio signal.

The input will be just an audio signal and I have to calculate the SNR of that signal. Can anyone suggest any library in python/C/C++ or any other language which does this or can be useful?

• Why do you need to calculate SNR? Typically SNR is something you know. It’s a parameter in an equation, or you set up a simulation where you have a signal and add noise to it. Once signal is mixed with noise, SNR can only be estimated provided you know the signal or noise. If you don’t know either, it becomes a guess.
– user28715
Commented Jun 1, 2018 at 5:20
• What is the sampling rate of the signal? It is really hard to create something to estimate the SNR in all cases. Each case requires its own treatment according to model.
– Royi
Commented Jun 1, 2018 at 14:44
• This is not a recommendation for a specific library, but assuming that you want to estimate the SNR, especially if your audio signal is a speech signal, compare this answer. Commented Jul 31, 2019 at 13:22
• Could you mark an answer or comment what is missing?
– Royi
Commented Sep 29, 2022 at 16:52

It is really hard to create something to estimate the SNR in all cases. Each case requires its own treatment according to model of the acquisition of the signal.

For instance, if the model is AWGN noise an the audio is of human voice and data is samples in high sample rate (Let's say above 44.1 [KHz]) then you can use a lot of the bins in the DFT of the signal to estimate the Noise STD. Then according to the energy in the bins of the data you can estimate the SNR.

Regarding a library, you might find general tools in Mozilla's Deep Speech library.