MATLAB: Segmenting a speech signal and adding noise

signal processingspeech recognition

hi! i need a matlab code to segment a speech signal to frames of 20ms each and add noise to each of them! pls help..

Best Answer

If you have the Signal Processing Toolbox, you can use buffer(). Otherwise you can use reshape(), but buffer() allows you to easily overlap the frames.
For example, I'll assume that the sampling frequency is 40 kHz, so that in this case 800 samples is 0.020
t = 0:1/40e3:10-(1/40e3);
x = cos(2*pi*2000*t)+sin(2*pi*4000*t);
x = x(:);
Y = buffer(x,800);
The above gives you 500 frames of 800 samples each with no overlap.
Now if you want a 0.005 overlap for each frame, that is 200 samples.
Y = buffer(x,800,200);
Then you can create a matrix of noise the same size as Y and add that noise matrix to your signal matrix.
Related Question