segmenting a speech signal and adding noise

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..

2 Comments

What have you done so far?
i gave a 2 sec speech as input.. using wavread.. i have to segment it with overlap and add a random noise (rand(1,n)) to each segment... without using inbuilt functions .. because i need to port to later...

Sign in to comment.

 Accepted 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.

3 Comments

thanks a lot for the help but i cannot use inbuilt functions..i have to segment it with overlap and add a random noise (rand(1,n)) to each segment...
How we can change SNR in speech signal while adding noise?
Simply adding noise will change the SNR, at least by some amount - it must since you have a finite quantized signal.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!