SNR is often used to process audio signal, in this tutorial, we will introduce you how to compute it using python.
What is SNR
SNR is called signal-to noise ratio, it is defined as:
As to Px, it can be computed as:
We can find the value of a clean singal SNR depends on the power of the noise signal. If the noise is changed, the SNR also be changed.
Often SNR is given in decibels (dB), it is:
It means:
If SNRdB = 0dB, SNR = 1, Ps=Pn, the power of the clean signal is equal to the noise signal.
If SNRdB > 0dB, the power of the clean signal is larger than the noise signal.
Moreover, Pn is also an estimator of the variance of the noise σ2. Therefore, one could have also defined the signal-to-noise ratio as follows:
How to compute SNR in python?
In order to compute SNR, we should get a clean signal and a noise signal.
You can view here:
https://github.com/hrtlacek/SNR/blob/main/SNR.ipynb