how can i add noise to a voice signal?

i have tried to use agwn and randn functions but it gives me error saying Integers can only be combined with integers of the same class, or scalar doubles.please help

Answers (1)

Wayne King
Wayne King on 6 Dec 2012
Edited: Wayne King on 6 Dec 2012
Your speech waveform is probably class int16 (I'm guessing), you can check by entering
class(waveform)
where waveform is the variable name for your speech signal.
To add noise, cast it to double (one option)
waveform = double(waveform);
Then you can add noise using randn() or agwn()
Another option is to cast the noise to int16 (or whatever class your waveform is) if you want the final signal to be integers. For example:
x = ones(100,1,'int16');
x = x+int16(randn(size(x)));
You just have to be careful to realize that the latter won't be strictly Gaussian (they're integers).

Asked:

on 6 Dec 2012

Community Treasure Hunt

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

Start Hunting!