Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

I have a bunch of audio files all sampled at 44100 Hz sample frequency. I am trying to remove all the frequencies which are outside the human hearing range (I use the following as reference: Frequency Range of Human Hearing, as well as robert.b's answer for determining the frequency value of a given bin: How to get Frequency from FFT result), and my basic approach is:

1. Perform an FFT on the files
2. Convert all frequency bin indices to actual frequencies
3. Remove those which are outside the range (i.e. below 20 and above 20,000 Hz)

Would that be a valid approach, and would it be possible to "put back" my signals to a state (using the inverse FFT) where I can play them and check if they still sound "normal"?

share|improve this question
    
What is the motivation for this ? You will not reduce the data by any significant amount. –  Paul R Dec 7 '12 at 15:19
    
The motivation is basically experimentation. I am just beginning with DSP and I would like to know more about how things really work on a pretty basic level (thus, my obviously beginner question). –  User3419 Dec 7 '12 at 16:10
    
OK - fair enough - you might find it more interesting to chop out all the frequencies above say 10 kHz - that would at least make an audible difference and it is something that you might want to do for a practical application, e.g. compress audio files by factor of 2 via 2x downsampling. –  Paul R Dec 7 '12 at 16:45
    
Thanks for the suggestion - it would be quite interesting to see what the result of this would be on the different sound files. –  User3419 Dec 7 '12 at 17:02
add comment

3 Answers

up vote 3 down vote accepted

What frequencies would you like to remove? 44.1kHz is specifically designed to capture audio files with good fidelity but also with not a lot of extra data. On the upper end, human hearing goes up to about 20 kHz. The Nyquist frequency is 22.05 kHz. The extra 2 kHz are needed to allow for anti aliasing filters that have finite steepness and not an extraneous amount of time domain ringing or group delay. At the low end, it can be beneficial to filter anything below 25 Hz or so specifically if it's badly recorded. Again, care need to be taken to control time domain distortions since the poles of a 25Hz high-pass at 44.1kHz are very, very close to the unit circle.

Zeroing in the FFT domain is generally a bad idea: If it's done wrong, it leads to time-domain aliasing which sounds terrible. If it's done correctly (by properly choosing window size, shape, step size, and overlap) it is still just equivalent to time domain filtering with a fairly bad FIR filter.

share|improve this answer
    
Thanks very much for the reply - I think this has been the most useful one, but pretty much all of the others provided about the same amount of useful information as well. By the way, I have a follow-up question (which I believe is related to the current discussion): if I wanted to perform analysis of my signals only in the frequency domain, would it make any difference if I ignored (i.e. thus the chopping out idea) those ones outside the human hearing range? –  User3419 Dec 7 '12 at 16:13
    
Depends on the specific types of analysis. If you want to do something that's mostly perceptual, you could drop some frequencies, but for, say, an impulse response calculation you need the whole thing. –  Hilmar Dec 8 '12 at 13:10
add comment

FFT -> zeroing coefficients -> IFFT is not a good approach for implementing filters. This will lead to a filter with poor performances and/or complicated implementation and/or inefficient implementation. This has been frequently discussed on this site, for example in this question.

Look into digital filters instead.

share|improve this answer
3  
I suggest the creation of a "dummy" question "Why FFT->zeroing coefficients->IFFT is not a good way of realizing filters?" in which we could summarize knowledge/explanations related to this common error/misconception. –  pichenettes Dec 7 '12 at 14:06
    
Thanks very much for your reply! That is actually a very good suggestion, since, I believe, many other beginners just like myself have considered approaching this seemingly straightforward problem in not the best possible way. –  User3419 Dec 7 '12 at 16:12
add comment

Yes, it is possible to filter out the frequencies that you don't want using FFT's and inverse FFT's as you describe. However, I do not recommend that you do it that way for a couple of reasons.

  1. It's tempting to just zero out the frequencies that you don't want. The problem with that is that it introduces strange artifacts when you transform your data back to the time domain. There is a way to avoid introducing those artifacts, but it is more complicated than just straightforward time-domain filtering.
  2. Unless you FFT the entire sound clip at once, you will have to use either the overlap-save or overlap-add method to avoid distortions at the points where you break the data up into frames.

Long story short, unless you really care about filtering speed, just do it in the time-domain.

share|improve this answer
    
Thanks very much - that makes perfect sense now, and your answer actually complements the previous ones very well. –  User3419 Dec 7 '12 at 16:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.