4
$\begingroup$

Is there a novel way to create a low-pass filter (Finite Impulse Response Filter) with varying cut off frequency over time?

For example, I have a white noise that is 10 seconds long sampled at 44.1 kHz. I want to create a low-pass filter that will have a varying cut-off frequency over time. At time 0 my cut-off frequency would be 100 Hz and will decrease linearly down to 1 Hz at time 10 seconds.

$\endgroup$
3
  • $\begingroup$ A system doesn't have to be time-invariant, so yes, you can build something like this. However, you must pay a bit of attention to the effects of a changing system. Can you explain what you need this for? I have several approaches in mind (from adjusting coefficients in a single-tap IIR over evolving a complete FIR through basically an adjustable IF with a fixed bandpass filter and a Hilbert transformator); whether any of these help you is unclear! $\endgroup$ Jun 8, 2019 at 17:53
  • $\begingroup$ Hi Marcus, I will use this to obtain an impulse response. Here is the process that I want to implement to produce an impulse response that I need. 1. Create 10 seconds white noise sampled at 44.1 kHz. 2. Apply exponential decay on the white noise such that the amplitude at time 10 seconds is near zero. 3. Apply a low-pass filter with varying cut-off frequency over time. I will convolve this derived impulse response in a human voice or a music. What do you think is best suited method in my case? $\endgroup$ Jun 9, 2019 at 9:27
  • $\begingroup$ Why do you want to do that, or to which end? What's the purpose of the convolution of voice or music with this? $\endgroup$ Jun 9, 2019 at 21:53

1 Answer 1

2
$\begingroup$

I wouldn't call this novel but... I'm going to give an example on how to do this for a specific filter with a specific discretization.

A 1st order butterworth low-pass filter is given by:

$H(s) = \frac{Y(s)}{X(s)} =\frac{\omega_c}{s + \omega_c}$

Where $\omega_c$ is the cut-off frequency of the filter.

The backward difference (aka backward euler) approximation is given by:

$s \approx \frac{1-z^{-1}}{T_s}$

Where $T_s$ is the sampling time. By substitution, the discrete transfer function becomes:

$H(z) = \frac{Y(z)}{X(z)} \frac{\omega_c}{\frac{1-z^{-1}}{T_s} + \omega_c} = \frac{\frac{\omega_c \cdot T_s}{1+\omega_c\cdot T_s}}{1 - \frac{1}{1+\omega_c\cdot T_s}\cdot z^{-1}}$

Let $a = \frac{\omega_c \cdot T_s}{1+\omega_c\cdot T_s}$, then:

$H(z) = \frac{a}{1 - (1-a)\cdot z^{-1}}$

Thus the difference equation is: $y[n] = a\cdot x[n] + (1-a)\cdot y[n-1]$

Why go through the tedious process of getting an equation for $a$ when I could have just used the above formula and try to guess some values for $a$? Well, now if you want to change the cut-off frequency $\omega_c$ in real time, you simply have to recalculate $a$ each time you compute the signal. This, of course, assumes you have a constant sampling period.

Note that this filter is an IIR filter, not FIR as you requested, but the logic is basically the same: as long as you know how your coefficients relate to the cut-off frequency, then you just simply have to recalculate them every time you want a different cut-off frequency. Nothing stops you from repeating the same steps for different discretization methods, different types of filters, etc...

You may even wish to work purely in the discrete-time domain, but the relevant part is always knowing how your coefficients relate to the cut-off frequency.

$\endgroup$
6
  • 2
    $\begingroup$ I hope I'm not too pedantic, but there's no 1st order Butterworth, or Chebyshev, or Cauer, 1st order is universal. $\endgroup$ Jun 9, 2019 at 6:38
  • $\begingroup$ @aconcernedcitizen My knowledge of signal processing has always been kind of ad hoc so I never realized that, oops! $\endgroup$
    – Chi
    Jun 9, 2019 at 15:49
  • $\begingroup$ Please also see dsp.stackexchange.com/a/54088/41790 and related posts by @Matt L. $\endgroup$
    – Ed V
    Jul 9, 2019 at 12:42
  • $\begingroup$ On a second thought, is that really true? A 1st order butterworth would have a transfer function of 1/(1 + (s/w)) where w is the cutoff frequency. If I change any of those "1" values to be some other value, then it's still a 1st order low pass filter but it no longer fits Butterworth's formula for the gain of the filter. $\endgroup$
    – Chi
    Sep 13, 2019 at 0:22
  • $\begingroup$ How do you handle the transition when IIR filter changes? AFAIK, for FIR filters I can deal it with overlap-add, but I have no idea for IIR filters. $\endgroup$
    – ZR Han
    Mar 1, 2021 at 1:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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