Follow up to question and comments posted here
The SNR calculation method posted as answers were implemented in matlab
Implementation of Deve's answer:
% the starting and ending point of speech in samples obtain through Audacity;
% select a portion of the waveform where speech is seen to be present
begin_speech = 25400; end_speech = 26800;
snr_before = mean( data_s(begin_speech:end_speech) .^2) / mean( data_n(begin_speech:end_speech) .^2);
db_snr_before = 10*log10( snr_before ); % same thing, but in dB
% calculation on data after noise reduction follows:
residual_noise = data_s(begin_speech:end_speech) - output(begin_speech:end_speech);
snr_after = mean( data_s(begin_speech:end_speech) .^ 2)/mean( residual_noise .^ 2);
db_snr_after = 10*log10( snr_after );
The result is
db_snr_before = 15.6853
db_snr_after = -22.0388
Implementation of dspGuru's answer:
begin_speech = 25400; end_speech = 26800;
% before noise reduction
DB1 = 10*log10( var(data_n(begin_speech:end_speech)));
DB2 = 10*log10( var(data_s(begin_speech:end_speech)));
db_SNR_before = DB2 - DB1;
% after noise reduction
[data_stnr, fs_stnr, nbits_stnr] = wavread('AdMStry_thru_nr.wav');
Z = output(begin_speech:end_speech) - data_stnr(begin_speech:end_speech);
db_residual_noise = 10*log10( var(Z) );
db_speech = 10*log10( var(data_stnr(begin_speech:end_speech)));
db_SNR_after = db_speech - db_residual_noise;
The result is :
db_SNR_before = 15.6848
db_SNR_after = 0.9252
The begin_speech and end_speech represent those parts of the wavfile, in number of samples, where there is presence of speech for certain (obtained through audacity by observing the waveform directly)
Why is the SNR less after passing through noise reduction?
In the second method (dspGuru), to calculate SNR after noise reduction, to get the Signal value on the numerator, I have passed just the pure speech through the noise reduction algorithm as well. If I do the same thing in the first (Deve) method, the results of the two methods become almost equal
Why is this happening? Why is SNR after less than SNR_before ?
Here is a screenshot of the waveforms:
No comments:
Post a Comment