Signal-to-noise ratio calculation for audio signal

Viewed 3203

I was applying a noise cancellation algorithm on a noisy audio file. I got good result. After that I calculated the SNR of the signal with noise and without noise. According to the theory, the SNR should increase for noise-free audio. But my results show a decrement.

Note: I used the implementation of scipy.stats.signaltonoise( ). As this is only useful to non-negative variables, i modified scipy.stats.signaltonoise( ) function. I divided numpy array of audio signal by the maximum element of that array. Then I took the square of each element of that array. By doing this, I made all the elements non-negative.

Here is the modified function-

def signaltonoise(a, axis=0, ddof=0):

    mx = np.amax(a)
    a = np.divide(a,mx)
    a = np.square(a)
    a = np.asanyarray(a)
    m = a.mean(axis)
    sd = a.std(axis=axis, ddof=ddof)
    return np.where(sd == 0, 0, m/sd)

Can anyone tell me why is this happening?

0 Answers
Related