How do I zero out a frequency of an audio signal?
6 views (last 30 days)
Show older comments
I am writing a matlab script that is supposed to do the following: I have a corrupted audio signal and my goal is to remove the tone that corrupts the singal. So far I have found the power spectral density of the audio signal and I have found the DFT of the audio signal by using the fft(x) command. The next step is for me to zero out the frequency associated with the tone causing the corruption. I am stuck on how to do this because I know the frequency associated with the tone, but I'm not sure how to zero it out.
I need to zero out X[K] and X[K-N] between kt-200 and kt +200
Thank you in advance
0 Comments
Answers (1)
Image Analyst
on 13 Sep 2023
Did you try something like
spectrum = fft(signal);
spectrum(kt-200 : kt+200) = 0;
denoisedSignal = ifft(spectrum);
if kt is an index.
Otherwise, scan your spectrum looking for a tall spike and zero it out.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
and tell us what K, N, and kt are, if you know them.
1 Comment
Image Analyst
on 14 Sep 2023
Yes that's correct. The fft result basically puts the zero frequency element at the first element and the last element. Then the middle of the vector is the highest positive frequency and most negative frequency. So that's why to zero out 4 kHz you must zero out +4 kHz and -4 kHz. For your homework you need to figure out what element 4 kHz and -4 kHz occur at. Knowing fs and the number of elements in the vector should enable you to do that. Worst case you might be off by a factor of 2.
See Also
Categories
Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!