MATLAB Creating Noise / Filtering With Matlab FFT for Tap Sound Masking

AI Thread Summary
To create noise that mimics the spectral properties of a recorded tapping sound for masking purposes, the initial approach involves generating noise using a complex random number function. However, this method may not yield the desired white Gaussian noise. The parameters 'm' and 'p' need clarification, with 'm' representing the length of the noise vector. The current method of using the absolute value of the FFT may lead to loss of important phase information when converting back to the time domain with the inverse FFT. Instead, a better approach is to use the MATLAB function 'wgn' to generate a vector of white noise, ensuring the frequency domain representation is flat, which is essential for effective masking.
nicoleisalie
Messages
1
Reaction score
0
I am trying to create noise that has similar spectral properties of a recorded tapping sound (so that I can mask the tapping sound). I was thinking that if I generate noise, and then multiply the fft of the noise by the fft of the tap sound, it would sort of "filter" the noise to the desired fft.

First off, I'm not 100% sure on how to create the noise. I am currently using:
noise=complex(randn(m, 1), randn(m, 1)*sqrt(p/2)
because I found an example online. I'm not really sure if this is white gaussian noise, or what. I'm also not sure what the m and p are.

Secondly, if I use abs(fft(noise)) and then multiple that by the abs(fft(TapSound)), I get the desired fft that I want (I think...?). but then if I use ifft to get back to the sound wave, won't that be missing important data because I used an absolute value?

Any help you can give me would be appreciated. Thank you!
 
Physics news on Phys.org
The function randn will return a value according to the Gaussian distribution specified by the parameters, but I don't think a vector of Gaussian random complex numbers is what you want (m is the length of the vector). The time domain values of the noise should be only real, and the frequency domain representation should be white. In other words, the magnitude of the frequency domain function should be flat or constant.

The MatLab function wgn can be used to create a vector of white noise.
 

Similar threads

Back
Top