How can I add white Gaussian noise to my clean audio

8 views (last 30 days)
Fs = 14400; t = linspace(0,1,Fs); w = 2*pi*1000; s = sin(w*t); sound(s,Fs);

Answers (2)

Star Strider
Star Strider on 28 Dec 2021
One option is to use the randn function to generate it.
Fs = 14400;
t = linspace(0,1,Fs);
w = 2*pi*1000;
s = sin(w*t);
ns = randn(size(t))*0.1; % Gaussian Random Noise, Standard Deviation = 0.1
sn = s + ns;
figure
subplot(2,1,1)
plot(t, s)
grid
title('Original Signal')
subplot(2,1,2)
plot(t, sn)
grid
title('Original Signal + Noise')
sound(sn,Fs);
.
  11 Comments
Haya AKKAD
Haya AKKAD on 9 May 2023
All right, you give me more than I expected in this helpful conversation. you deserve all the best
Thanks Again and good night

Sign in to comment.


Image Analyst
Image Analyst on 28 Dec 2021
Try this:
Fs = 14400;
t = linspace(0,1,Fs);
w = 2*pi*1000;
s = sin(w*t);
subplot(3, 1, 1);
plot(s(1:100), 'b-', 'LineWidth', 2)
grid on;
title('Original Signal')
noiseAmplitude = 0.2;
noiseSignal = noiseAmplitude * randn(1, length(s));
subplot(3, 1, 2);
plot(noiseSignal(1:100), 'b-', 'LineWidth', 2)
grid on;
title('Noise Signal Alone')
sNoisy = s + noiseSignal;
subplot(3, 1, 3);
plot(sNoisy(1:100), 'b-', 'LineWidth', 2)
grid on;
title('Noisy Signal = Signal + Noise Signal')
% sound(s,Fs);

Community Treasure Hunt

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

Start Hunting!