필터 지우기
필터 지우기

I want to add noise (10dB,20dB) to my speech samples. I have used this code to add noise but i do not know how much dB of noise is been added because this is random noise

조회 수: 8 (최근 30일)
[s, fs] = audioread(file);
rng default
noise = 0.01 * rand(size(s));
noisySig = s + noise;
SNR4545= snr(s,noise);
% calc SNR using equation
sigPow_check = 10 * log10(mean(s.^2)); % signal power
noisePow_check = 10 * log10(mean(noise.^2));% noise power
SNR_check = sigPow_check - noisePow_check;
fprintf('\n calculation with equation: \n');
fprintf('SNR: %.2f dB \n', SNR_check) ;
fprintf('noise power: %.2f dB \n', noisePow_check) ;
fprintf('signal power: %.2f dB \n', sigPow_check) ;
Results: calculation with equation: SNR: 8.91 dB noise power: -44.78 dB signal power: -35.87 dB
  댓글 수: 2
Souarv De
Souarv De 2022년 3월 5일
SNR = 20;
Noise = randn(1,length(s)); % Generate initial noise;
Signal_Power = sum(abs(s).*abs(s))/length(s); % Signal Power
Noise_Power = sum(abs(Noise).*abs(Noise))/length(s); % Noise Power
K = (Signal_Power/Noise_Power)*10^(-SNR/10); % Scale factor xdB SNR
New_Noise = sqrt(K)*Noise; % Change Noise vector
x = S + New_Noise;
studentmatlaber
studentmatlaber 2022년 3월 6일
Here you have fixed it as SNR = 20. But shouldn't you write as SNR = Signal_Power/Noise_Power?

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

답변 (0개)

카테고리

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