QtVST: a Chamberlin Variable Filter

After my last post on QtAgain, I’ve decided to test a few simple digital filters. I’ve tried to make them as generic as possible, and with a VST interface.

A templated Chamberlin filter

A Chamberlin filter is a IIR (Infinite Impulse Response) filter, and it is possible to make it output high-, band- or low-pass signals. It has only two parameters that are independent.

The equations are very simple:

Each of the series is either the low-pass, the band-pass or the high-pass output.

There are some factors that are pre-computed:

The first is a function of the Cut frequency and the Sampling frequency, a “numerical frequency”. The second one is the numerical attenuation, between 0 and 2.

This is an excerpt of the actual code, I’ve only displayed the relevant code.

class VariableFilter
  typedef Data_Type DataType;

  void process(const DataType* in, DataType* out, unsigned long nb_samples)
    for(unsigned long i = 0; i < nb_samples; ++i)
      yh = in[i] - yl - numerical_attenuation * yb;
      yb = numerical_frequency * yh + yb;
      yl = numerical_frequency * yb + yl;
      if(selected == 0)
        out[i] = yl;
      else if(selected == 1)
        out[i] = yb;
        out[i] = yh;

  void compute_factors()
    numerical_frequency = 2 * std::sin(M_PI * cutoff_frequency / sampling_frequency);
    numerical_attenuation = 2 * attenuation;

Now, I've written a simple GUI for this plugin.

GUI with Qt

I've used the QtAgain skeletton to wrap the filter and to make it available to PyVST. It's really easy to add other parameters to the skeletton, so I will not write everything here again. There are three parameters, 2 numerical ones, and one three-state variable.


I've recorded the filter's outputs for 6kHz as central frequency, and an attenuation factor of .3. The output signal was generated from a random signal, and then an FFT was performed on the inputs and the outputs and displayed.

Note: I didn't convert the scale to dB.

As you may have noted, the filter amplifies the signal near the central frequency for each output for the attenuation I've selected. The issue is that selecting a higher one has also an impact on the stability of the filter at higher frequencies. The sum of the numerical attenuation and the numerical frequency should always be inferior to 2.


This numerical is really simple to implement, and it has few parameters. The dark side of this filter is that is not always stable and the central frequency seems to be always amplified. Other filters can be better balanced.

The code is available on Launchpad.

Buy Me a Coffee!
Other Amount:
Your Email Address:

4 thoughts on “QtVST: a Chamberlin Variable Filter

  1. Hi,

    Congratulations on using Qt to create VSTs such as this one or AGain 🙂 This makes me hope that someday, we’ll have some cool VSTs working both on windows and linux.

    Speaking of which, i’ve been searching for a clean solution for quite a long time. I mean, using QWinWidget makes integrating the GUI quite simple it seems, but for the synth i’m developing, it’s a no-go since i want to keep it fully multiplatform and the same problem happens on linux.

    I tried using QWidget::create(WId handle). It, well, kinda works : keyboard input is OK on every host, but while mouse input works in Renoise, it does not in FL Studio for example (well… mouse scrolling works, context menu too, but not the simple “press” event – focus goes from one widget to another, but clicks are just ignored (ie. buttons are not pressed).

    Did you continue trying to get the QWidget::create(hnd) solution working once finding about this one ? Or have you found a multiplatform solution ?

    Thanks in advance,

    1. The issue is to create an event loop behind your widget. If you only use create(WId handle), it will not work because Qt will not be able to dispatch the event to your widget. This is fact the main thing about QWinMigrate: the event loop. Perhaps Renoise is in fact written with Qt?

      I have to say that I don’t know what to think about VSTs for Linux. We should at first have an official support from someone, and then we could try asking Nokia for a Solution for using the event loop of a Linux application. Or the reverse BTW. Once we have a workaround for Linux, we can have a multiplatform widget that would use QWinWigdet on Windows, ??? for Mac and ??? for Linux. I still have to work on a single class/group of classes that are clean and reusable, it’s not the case yet.

  2. I can try to help here, i’m interested in trying using Qt in VST development (especially under linux), to serve a cross platform solution. I’ll let you know how far i go…

  3. I’m also interested in making Qt gui on Linux. I think I have something working (with the help of kRAkEn above). Maybe we can make something reusable together? I hope we can make your VST plugins work on Linux 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.