adding noise to a wav file

조회 수: 32 (최근 30일)
AngelsaAtWar
AngelsaAtWar 2013년 3월 27일
댓글: Walter Roberson 2018년 3월 31일
if I add noise to the script...
load handel.mat;
hfile= 'handel.wav';
wavwrite(y, Fs, hfile);
nsamples=Fs;
[y, Fs , nbits, readinfo]= wavread(hfile,nsamples);
sound(y(round(2.85/4*end):end),Fs);
How would I do so, I know I need some kind of vector to do it but I dont know how to approach it

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 27일
y = y + randn(size(y));
  댓글 수: 3
Walter Roberson
Walter Roberson 2013년 3월 27일
Multiply randn() by a fraction, such as 1/10 or 1/100.
AngelsaAtWar
AngelsaAtWar 2013년 3월 27일
It works, Thank you very much for the help. I really apprecite it

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Youssef  Khmou
Youssef Khmou 2013년 3월 27일
편집: Youssef Khmou 2013년 3월 27일
hi,
You have many ways :
1) method one :
Mean=0.00;
Var=0.005;
z=imnoise(y,'Gaussian',Mean,Var);
You can control the amount of noise to add, with N(mean,variance ), and also you can change the type of noise you want ' Poisson','speckle'.....
2)method two :
SNR=15;
z=awgn(y,SNR,'measured');
With awgn stands for Additive white Gaussian noise, u work here in terms of Signal to Noise Ratio with SNR=20 log10( signal_power/ noise_power ).
3) method three :
Like Walter answer :
STD=sqrt(0.005); % STANDARD DEVIATION
z=y+STD*randn(size(y))
z=y+randn(size(y)) ; % Means adding Zero mean noise and VAR=1 .
  댓글 수: 1
Youssef  Khmou
Youssef Khmou 2013년 3월 27일
example, i prefer working with SNR :
load handel.mat
Y=y(round(2/3*end:end));
SNR=11; % dB
Z=awgn(Y,SNR,'measured');
figure, plot(Z), hold, plot(Y,'r'), legend('AWGN snr=11dB',' Clean Signal')

댓글을 달려면 로그인하십시오.


tayyab awan
tayyab awan 2018년 3월 31일
How to remove this noise in order to retrieve the original signal ??
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 3월 31일
There have been a number of Questions dealing with noise removal; you should do a search.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by