Compensate for delay caused by filters

Hello everyone,

I’m having an issue with filtering using the highpass8 function in Nyquist plugins that’s causing a delay of approx. 70ms (HPF at 80Hz) on the lowest frequencies, which decreases as the frequencies get higher. Although this is not always an issue, in some cases it’s necessary to keep the frequencies aligned as they were before filtering.

Here’s a screenshot that shows the delay measurement. Please note that the spectrogram is in logarithmic scale:

Can anyone help me figure out how to compensate for this frequency-dependent delay? I’d appreciate any advice you may have.

Thank you!

Looks like ringing, rather than “delay” …

To compensate for the delay you can apply the filter in two passes, once in the forward direction and once in reverse. For example, for a 48 dB/octave high-pass filter:

  1. Reverse the audio
  2. Apply a 24dB/oct high-pass filter
  3. Reverse the audio again
  4. Apply a 24dB/oct high-pass filter

Alternatively, use a FIR filter (such as Audacity’s “Filter Curve EQ”).

1 Like

Thank you. I was already considering this approach and I saw your another post: Reversing sound with Nyquist

I need to process sound with duration up to one hour. So RAM and computation time are my concerns.

But if there is no other way…

Is it possible that Matlab version of biquad (biquad-m) can compensate this internally?

Is there a FIR filter Nyquist function?

Audacity’s built-in “Reverse” effect can reverse very long tracks.

Nyquist does not have a ready-made FIR filter, but the “Spectral Delete” shows an example of how to make one using fast convolution. However, it would be easier to use Audacity’s Filter Curve EQ.

If you need to wrap it all into one command, you could create a macro with multiple effect steps.

Thank you for providing this information. While I appreciate the recommendation to use built-in effects, the subject of this thread is part of the final fine-tuning of my own Nyquist plugin, and built-in effects (non-Nyquist) are not something I can incorporate into my current project.

I recall our previous discussion on this topic, where we referred to the filters in Spectral Delete as “sinc filters”. Sorry I am not an expert, is “FIR filter” another name for “sinc filter”? I have experience in using sinc filters and in fact, I developed a variation of the Spectral Delete plugin called Spectral Gain, which includes these filters.

However, when I use these filters in my current project, there were some issues that I was struggling with, specifically ringing and strange vertical-line artefacts in the spectral domain. I wasn’t able to overcome these issues, so I switched back to Butterworth filters. Currently, I’m implementing Linkwitz-Riley filters (2xButterworth), which have produced better results for my needs.

If there is not a better solution, I will try to implement a workaround with the signal reversion. If this is too heavy for RAM and computation time, I will drop this and keep it as it is. It is not a major issue.

Maybe it is just a matter of perspective. Here are some extreme examples to demonstrate what actually happens when using standard Audacity HPF/LPF filters or their corresponding Nyquist functions:

HPF - The frequency-related part of the sound is shifted to the right. The lower the frequency, the bigger the shift. In this context, that frequency-related part of the sound is delayed in comparison to the rest of the signal.

LPF - Here we can see the same problem, plus one extra “global” delay. The higher the frequency, the bigger the shift. Additionally, the whole signal is moved to the right.

Note that these are extreme examples. Filters were applied multiple times for demonstration purposes. If you divide the measured delay from the example above by the number of filtering repetitions, you get the delay value for a single filtering, which is not zero. In some applications, it is necessary to take this into account.

From Wikipedia:

a sinc filter is an idealized filter that removes all frequency components above a given cutoff frequency, without affecting lower frequencies, and has linear phase response. The filter’s impulse response is a sinc function in the time domain ( sin ⁡ ( π t ) π t ) , {isplaystyle eft({frac {in(i t)}{i t}}ight),} and its frequency response is a rectangular function.

Sinc filters are usually implemented as FIR filters, but FIR filters do not have to be Sinc filters. Many filter shapes can be implemented as FIR filters.

This topic was automatically closed after 30 days. New replies are no longer allowed.