how can i add Uniformly distributed noise between 44-55 [hz] to a speech signal?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
rivaldo rivaldo
le 5 Juin 2017
Commenté : Star Strider
le 7 Juin 2017
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;
0 commentaires
Réponse acceptée
Star Strider
le 5 Juin 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 commentaires
Star Strider
le 7 Juin 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.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Simulation, Tuning, and Visualization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!