1
\$\begingroup\$

I'm facing a real case of DSP application. I have a basic knowledge of digital filtering and telecommunication issues.

The input of my "black-box" is a digital audio signal (say a common WAV file, stereo 44100 Hz, 16-bit). I need to develop a digital equalizer and create the output audio samples.

The computation has to be done in real-time, i.e. with a live-stream. I'm aware that it means I have to define a buffer large enough to feed the filters.

The basic approach is to create several pass-band digital filters to change the gain of the frequencies in each band. Because the requested bands are a lot (> 16) I'm going to work in the frequency-domain.

My thought:

  1. convert the signal in frequency-domain (DFT)
  2. define a shape of the desired response
  3. process the input samples with this shape
  4. revert back to time-domain to retrieve the actual audio samples

Questions:

  1. what is the technical name of this method?
  2. do you think this approach is better(*) than use a lot of steep pass-band filters?

(*) better here is not just an opinion: I'm talking about code complexity, latency and accuracy

\$\endgroup\$
  • \$\begingroup\$ you should use FFT, not DFT, FFT has fast implementation when your sample length equal to \$2^n\$. Sometimes. it is better to multiply with windowing in the frequency domain, changing one sample may generate ringing in the time signal \$\endgroup\$ – M KS Nov 17 '18 at 14:20
  • \$\begingroup\$ It might be more straightforward to convert your desired frequency response into a time-domain response (impulse response) using an inverse DFT, then processing the audio with the resulting FIR filter. This filter will be rather long for good precision, so one limitation would be how much latency and/or phase shift you can tolerate. \$\endgroup\$ – Dave Tweed Nov 17 '18 at 14:44
  • \$\begingroup\$ @DaveTweed in the main use-case scenario the latency might be quite long, even 500 ms or more. Other scenarios where the latency should be kept under 250 ms are nice to have with a trade off on the accuracy of the frequency response. \$\endgroup\$ – Mark Nov 17 '18 at 14:52
2
\$\begingroup\$

Your question is better suited for the signal processing stack exchange, and this is perhaps the answer you are looking for. However, the basic issues are:

  • FFTs/DFTs are filters, however (1) their frequency response is not ideal as these overlap each other on the continuous domain, (2) are not spaced in a way that best matches our auditory response leading to wasteful processing, and (3) are circular convolutions which can lead to sample-to-sample discontinuities.

  • What you are looking for is an efficient orthogonal filter bank that is logarithmically spaced in the frequency domain. There exist several approaches to these.

  • An appropriate wavelet transform could be more efficient, as decimation is introduced on every step which bypasses the fixed bin resolution of FFTs.

  • In particular the Invertible Constant-Q Transform was designed with these problems in mind.

Although I am not very familiar with it, I can come-up with a methodology that might serve your purpose based on the wavelet approach.

  1. Design a filter that extracts the top half of the frequency domain to the desired order.
  2. Divide the domain in two orthogonal sections, by applying the filter and subtracting the filter output from the input.
  3. Keep the top component for processing. This is the detail coefficient.
  4. Decimate the lower frequency component by throwing away half the samples. This is the approximation coefficient.
  5. Apply the filter again to the decimated half.
  6. Repeat the process, successively dividing the spectrum in bands that are logarithmically spaced.
  7. Apply the desired scaling.
  8. Successively upsample (which includes low-pass filtering) each low band and add it to its corresponding high-band to reconstruct the filtered signal.
  9. As the detail coefficients are band-limited as well, these can also be decimated and processed the same way to provide a higher frequency resolution.

Note that each lower-band takes twice the number of samples to process so this is an instance of variable-rate filtering characteristic of wavelet transforms. However, the total sampling rate remains constant due to the intervening sub-sampling.

There are some phase issues that would need to be addressed and would lead to practical limitations in the filters. Wikipedia goes at length on the Discrete Wavelet Transform.

\$\endgroup\$
  • \$\begingroup\$ Are you talking about quadrature mirror filters? \$\endgroup\$ – Dave Tweed Nov 17 '18 at 14:39
  • \$\begingroup\$ Probably. The term sounds very familiar as in predating wavelet transforms, but I haven’t closely followed this field in decades. So I am not totally aware of how that terminology evolved. \$\endgroup\$ – Edgar Brown Nov 17 '18 at 14: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.