how can i add Uniformly distributed noise between 44-55 [hz] to a speech signal?

6 次查看(过去 30 天)
i tried this one but i'm getting an error
Error using randi
Requested 407792x407792 (1239.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit
may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
clear all;close all;clc
[x,fs,Nbits] = wavread('jennifer.wav');
l=length(x);
y=randi([44,55],l)+x;

采纳的回答

Star Strider
Star Strider 2017-6-5
This creates an (lxl) matrix of random integers between 44 and 55:
y=randi([44,55],l)+x;
That is not what you want to do anyway.
To create uniformly-distributed noise between 44 and 55 Hz, try this:
[x,Fs,Nbits] = wavread('jennifer.wav');
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = [44 55]/Fn; % Passband Frequencies (Normalised)
Ws = [43 56]/Fn; % Stopband Frequencies (Normalised)
Rp = 10; % Passband Ripple (dB)
Rs = 50; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby2(n,Rs,Ws); % Filter Design
[sosbp,gbp] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(3)
freqz(sosbp, 2^17, Fs)
L=length(x);
noise = rand(1, L); % Normally-Distributed Random Vector
noise_filt = filtfilt(sosbp, gbp, noise); % Filter Noise Signal
noisy_signal = x + noise_filt;
The filter code works, however I have not used this with your sound file. Note that the output of wavread and audioread scale (or normalise) the output to a maximum amplitude of ±1, so use the rand function, since its output is [0,1]. You may want to reduce the noise amplitude even further to avoid completely ‘swamping’ your audio signal in the noise.
  16 个评论
rivaldo rivaldo
rivaldo rivaldo 2017-6-7
Thank you.
My last mission is to implement this noisy signal with 3 different SNR:
-10dB
0dB
+10dB
I tought may be to create function that calcultates the noisy signal when the input is those 3 different snr.
what do you say?
Star Strider
Star Strider 2017-6-7
How are you supposed to calculate SNR?
My code gives the amplitudes of the signal and noise. You may need to calculate the RMS amplitudes of both the signal and noise, then solve for the required noise amplitude in terms of the desired SNR with respect to the amplitude of your signal.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulation, Tuning, and Visualization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by