Adding noise to a sound

Viewed 181

I have a signal that it has an array c(500000 x 2) with two channels and one frequency fs. I want to add a Gaussian sound to the first channel of the sound . I have create a vector and create a Gaussian sound

p=zeros(500000,1);
f=awgn(p,30);
sound(f,fs) ;

,that plays the sound with Gaussian noise. I want now to put that noise ( f ) to the first channel of the sound . I am new to matlab so i tried something of with awgn function

c1=awgn(f/2,30);

but it doesnt work. Any suggestions??

1 Answers

awgn() Returns the Original Signal With Guassian White Noise Added to It

Seems like you already added Gaussian noise in your first step. Here is a script that you can use to test how Additive White Gaussian Noise (AWGN) affects audio. Here you hear that the awgn() returns the audio signal with the noise added. By playing with the Signal_To_Noise_Ratio you'll be able to hear more or less of the original audio due to the amount of noise distorting/obstructing the signal. Use the command clear sound to end playing your chosen audio file/signal.

File_Name = "Audio.mp3";
Audio = audioread(File_Name);

Original_Signal = Audio(:,1);
Signal_To_Noise_Ratio = 20;

Noisy_Signal = awgn(Original_Signal,Signal_To_Noise_Ratio);

%Playing back at the sampling frequency, Fs%
Fs = 44100;
sound(Noisy_Signal,Fs);

Applying Gaussian Noise to a Trivial DC Signal:

Below shows the result of applying the Additive White Gaussian Noise on a DC signal that is constantly equal to 1. The output of the awgn() function is the signal with the noise added on top.

Noise Applied to DC Signal

Original_Signal = ones(1,100);
Signal_To_Noise_Ratio = 20;

Noisy_Signal = awgn(Original_Signal,Signal_To_Noise_Ratio);

plot(Original_Signal);
hold on
plot(Noisy_Signal);
title("Applying Gaussian Noise with SNR = " + num2str(Signal_To_Noise_Ratio));
legend("Original Signal","Noisy Signal");

Ran using MATLAB R2019b

Related