# Low-pass filter with varying cut-off frequency over time

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.

• 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! Commented Jun 8, 2019 at 17:53
• 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? Commented Jun 9, 2019 at 9:27
• Why do you want to do that, or to which end? What's the purpose of the convolution of voice or music with this? Commented Jun 9, 2019 at 21:53

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.

• I hope I'm not too pedantic, but there's no 1st order Butterworth, or Chebyshev, or Cauer, 1st order is universal. Commented Jun 9, 2019 at 6:38
• @aconcernedcitizen My knowledge of signal processing has always been kind of ad hoc so I never realized that, oops!
– Chi
Commented Jun 9, 2019 at 15:49
• Please also see dsp.stackexchange.com/a/54088/41790 and related posts by @Matt L.
– Ed V
Commented Jul 9, 2019 at 12:42
• 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.
– Chi
Commented Sep 13, 2019 at 0:22
• 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. Commented Mar 1, 2021 at 1:27