how to determine SNR of an audio signal in MATLAB ?

26 views (last 30 days)
how to determine SNR of an audio signal in MATLAB ?

Answers (1)

Rahul
Rahul on 3 Jan 2025
In order to measure the 'Signal to Noise ratio' (SNR) of an audio signal, consider using the 'snr' function directly. The following MATLAB Answer expains this approach:
As SNR is defined as the power ratio between a signal and the background noise, hence SNR can also be computed by comparing the power values of the signal and the noise as mentioned in the following MATLAB Answer:
Here is an example:
[signal, fs] = audioread('audio_signal.wav');
[noise, fs_noise] = audioread('noise_signal.wav');
% Calculate the power of the signal
signalPower = sum(signal.^2) / length(signal);
noisePower = sum(noise.^2) / length(noise);
% Calculate SNR in dB
SNR = 10 * log10(signalPower / noisePower);
The following MathWorks documentations can be referred to know more:
Thanks.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!