I'm trying to add White Gaussian Noise to an audio file. However; the energy of the noise should be 1/10th of that of the signal. My first attempt is as following:
[y,Fs] = audioread('drum.wav');
%sound(y,Fs);
noisy_sig = addnoise(y,10);
sound(noisy_sig,Fs);
function noisy_sig = addnoise( sig , SNRdb )
sig_power = norm(sig,2) / length(sig);
% noise power is equal to sigma^2
sigma2 = sig_power / 10^(SNRdb/10) ;
noisy_sig = sig + sqrt(sigma2)*randn(size(sig));
end
When I listen the resulting wav, there is no difference between the original and noisy ones. Am I doing something wrong? Any help would be appreciated.