Search code examples
matlabfile-iosignal-processingnoise

Adding noise to speech signal


I'm attempting to add noise to a speech signal (.wav file) in matlab using the following method:

load handel.mat;

hfile= 'noisy.wav';

y = wavread('daveno.wav');
y = y + randn(size(y)) * (1/100);
wavwrite(y, Fs, hfile);
nsamples=Fs;

This adds the noise, however, it removes the actual speech spoken word and therefore, the noise is only contained. Do I need to multiply by a bigger number, or, could anyone please suggest a way to fix this problem?


Solution

  • The issue is that you are writing the file at the wrong sampling frequency. Find the correct sampling frequency (i.e. the value for Fs) using the second output of wavread

       [y, Fs] = wavread('daveno.wav')