Search code examples
matlabnoise

adding white Gaussian noise using matlab


Add white Gaussian noise to your recorded voice signal, with a " spectrum that does not

conflict with your voice spectrum" (High frequency noise).

So for the above statment, does it means their magnitude should be the same?

I have added white Gaussian on my voice using matlab command :

noisyVoice = awgn(myVoice,1) 

This is the graph of both my voice and the noisy voise ( the one with added white Gaussian noise) :

enter image description here


Solution

  • One solution is to filter the Gaussian noise and then modulate it to a specific frequency band.

    Fs = 1000;
    L = 500;
    t = (0 : L-1)/Fs;
    x = chirp(t,10,.5,100);
    NFFT = 2^nextpow2(L); 
    Y = fft(x,NFFT)/L;
    f = Fs / 2 * linspace(0,1,NFFT/2+1);
    subplot(211)
    plot(f,2*abs(Y(1:NFFT/2+1))) 
    title('Amplitude Spectrum of Noise-free Signal')
    xlabel('Frequency (Hz)')
    b = fir2(30,[0 2*50 2*50 Fs]/Fs,[1 1 0 0]);
    n = randn(L, 1);
    nb = filter(b,1,n);
    newx = x + nb' .* cos(2*pi*300*t);         % x + modulated noise (Fc = 300Hz)
    newY = fft(newx,NFFT)/L;
    subplot(212)
    plot(f,2*abs(newY(1:NFFT/2+1))) 
    title('Amplitude Spectrum of Noisy Signal')
    xlabel('Frequency (Hz)')
    

    enter image description here

    You should adjust the low-pass filter and modulation frequency with your data.