0
$\begingroup$

I want to compute acoustic features on a set of audio files. These features can be classical audio features as spectral flux, but also acoustic indices as proposed in the seewave R package ).

I need, in a pre-processing step, to remove low frequency noise (approximatively inferior at 200 Hz), that could be caused for example by wind or a distant road, and are not appropriated for the analysis.

As my features can be computed both from temporal and spectral values extracted from the audio signal, I am considering the use of a temporal high pass filter. This approach seem to me more adequate than a filtering on the spectral domain (with a reconstruction of the signal by an inverse Fourier transform). Am I right?

Therefore I am looking for an high-pass digital filtering method that will remove low frequencies, but preserve as much as possible the high frequencies. If it is possible, I would like that the amplitudes of the fft bins above the cutoff frequency could stay the same after the filtering.

What is the best method for this application? Is it relevant to use a temporal filter rather than a filtering on the fft bins?

Concretely, I will use a python implementation (with scipy). I am now considering the use of a butterworth filter with the filtfilt function. Is this method appropriate? Is there a better solution for this issue?

Ant help or suggestion will be appreciate.


Edit

  • Sampling rate of the audio files: 48 kHz
  • Low frequency band to remove: around 0-300 Hz
$\endgroup$
  • $\begingroup$ I think any large-order high-pass filter should suffice. $\endgroup$ – MBaz Dec 7 '15 at 16:20
  • 1
    $\begingroup$ "Best" depends on a lot more details of your requirements (transition band, stop band, pass band ripple, phase linearity, filter latency or computational complexity, etc.) $\endgroup$ – hotpaw2 Dec 7 '15 at 17:29
  • $\begingroup$ I edited the question with regard to the first comments $\endgroup$ – sandoval31 Dec 9 '15 at 9:47
3
$\begingroup$

I agree that a large-order (12 taps+) high-pass Butterworth filter will be sufficient.

Why? Well, Butterworth filters are commonly used in professional audio-editing applications to do filtering, because their frequency response is designed to be as flat as possible in the passband. This means that the filtered audio is of higher quality/fidelity, as there are less frequency "ripples" or "artifacts" in the passband than other comparable filter types (Chebyshev, elliptic). In other words, Butterworth has a more linear phase response in the pass-band.

The downside is that the Butterworth filter has a slower roll-off, and will require a higher-order to implement a particular stopband specification. But this shouldn't be an issue for you.

enter image description here

To answer your second question, this is why the above solution is preferable to using an FFT and zeroing out the bins: Why is it a bad idea to filter by zeroing out FFT bins?

$\endgroup$
  • $\begingroup$ Is 12 the minimum order of the filter? I am experiencing problems with order 12. Scipy output onlyn "NaNs". See this topic for an example: stackoverflow.com/questions/8811518/…. However if seems to work with order 9 maximum and a frequency of 300 Hz. Could you tell me why should I use an oder of 12? $\endgroup$ – sandoval31 Dec 15 '15 at 10:43
  • $\begingroup$ I edited the question to precise the sampling rate and cut-off frequency $\endgroup$ – sandoval31 Dec 15 '15 at 12:03
  • $\begingroup$ You should use the filter-order that makes sense. I was suggesting ~12 taps as a starting point, but this is only a suggestion. You should experiment to see what order gives you satisfactory results. Good luck! $\endgroup$ – ruoho ruotsi Dec 15 '15 at 17:51
1
+50
$\begingroup$

OK, a few things.

  • Zeroing bins in frequency space is equivalent to applying a rectangular window. That means that you actually convolve your audio signal with a sinc function. In practice, because you don't have an infinite sampling, that eventually means audio artifacts.
  • The Bessel/Butterworth/Chebychev/Elliptic filters are optimal "physical" filters (though they are not optimal for the same thing). As a group, their main advantages are:
    • they have electronic counterparts, so they are familiar;
    • they can be implemented as IIR filters so they can work on streams of data without fancy blocking algorithm and they can be very versatile and insanely fast.
  • Nowadays, especially for audio and analysis, people tend to use a windowed-sinc filter instead of these because it is clearly better in most of the situations. If you can afford that one (i.e. if you are not streaming anything with high delay constrains and you have a computer that is not 20 y/o), this is most likely the best solution for you.
$\endgroup$
  • $\begingroup$ Sounds really interesting. Is it related to a Gabor filter in 1D? Besides, what about the implementation? I found a python implementation for low pass filter here: tomroelandts.com/articles/…. However, it seems that it doesn't exist with the scipy package. Any help to implement a high-pass filter in python? Thanks $\endgroup$ – sandoval31 Dec 15 '15 at 14:25
  • 1
    $\begingroup$ The high-pass version of the tomroelandts.com link is here: tomroelandts.com/articles/… $\endgroup$ – ruoho ruotsi Dec 15 '15 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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