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

7 Ansichten (letzte 30 Tage)
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;

Akzeptierte Antwort

Star Strider
Star Strider am 5 Jun. 2017
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 Kommentare
rivaldo rivaldo
rivaldo rivaldo am 7 Jun. 2017
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 am 7 Jun. 2017
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulation, Tuning, and Visualization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by