How to build a filter bank?

I’m interested in simulating real instruments, in my case an accordion. From reading Sound on Sound’s Synth Secrets series, it seems like what I want to do is run a sawtooth wave through a filter bank. Apparently “formants” are important?

I see there are formant modules and there are sophisticated equalizers, but I’m more interested in using fundamental filters to build something myself. I’m using VCV Rack as a prototyping tool and eventually I want to write code that runs on a Teensy.

So, my question is what filters should I use, and is this a reasonable thing to do in VCV Rack? In Teensy’s audio library there is:

  • “filter” which is described as “A State Variable (Chamberlin) Filter with 12 dB/octave roll-off, adjustable resonance, and optional signal control of corner frequency.”
  • “fir” which is a “finite impulse response filter”.
  • “biquad” which is a “Biquadic cascaded filter, useful for all sorts of filtering. Up to 4 stages may be cascaded.”

I know what some of those words mean, sort of.

So, I’m looking for filter modules that are not lovingly-detailed models of real-world filters with all their quirks, but rather fundamental primitives that are useful building blocks. Has anyone played around with this? Any recommendations or suggestions for further reading?

1 Like

VCV Paremetara (or whatever it’s called) would be perfect. I’d probably look for a simple bandpass filter and use one for each formant band. Run in parallel and mix the outputs. Something like that would be close. Or use resonant lowpass filters. Our module “Formants” is, as you note, not what you want, but that’s what it is inside - parallel BPF or LPF (user selectable). btw, that module uses the Chamberlin state variable, but any LFP or BPF will do.

3 Likes

https://vcvrack.com/Parametra

1 Like

Yes, Parametra is transparent without having any character. (It uses biquad filters.)

VCV Spectra has lots of color/character and is specifically designed as a filter bank / vocoder / formant filter.

1 Like

I haven’t fully exposed the surge filters yet (there is a lot in there) but the surge filters are made from a cascade of biquads and waveshapers, and in the surge-rack module is the “SurgeBiquad” module which has each of the biquad configurations as a single filter stage, if that helps. The waveshaper is also available as a separate module.

I did buy Parametra and I’ve been playing around with it.

Although Parametra has a built-in display for this, I found that I like displaying the spectrum separately using the BogAudio analyzer, since it lets you zoom in and has more lines to read off the frequency of peaks. I’m working in mono and Parametra is stereo, so a trick here is to put white noise on the other stereo channel and display both on the frequency analyzer, so you can compare what the filters do to a flat spectrum to what the music is doing. (With polyphonic filters you could do this on an unused channel.)

I tried recording notes on my accordion and doing some frequency analysis. It’s difficult to interpret, but the main thing I figured out is the overall frequency range and that there is a valley at around 720-750 hertz. It seems to help to get a more box-like hollow sound.

Also, having multiple detuned waves helps get a more saw-like sound and the Blamsoft oscillator makes it easy to experiment with that.

Here’s a screenshot. The complication in the top row is because accordions have one octave of bass buttons and use Shepard tones to make them blend well. The lowest bass reeds are blended with the reeds one octave above. I wanted to use the same oscillator settings for everything and then cross-fade based on the note being played, so the input has four channels of polyphony but there are eight going into the oscillator, and then it’s converted back to two polyphonic cables and mixed.

2 Likes

Our “saws” module s a cheap and easy way to get a lot of detuned saws.

1 Like

Ah, yes, but I need polyphony. And it turns out two saws is enough for what I’m doing.

I have a sound that seems okay to get started and now I need to figure out how to translate it into code. How are the filters in Parametra mixed together? Maybe I will see what I can do combining simpler filters.

I think what I want is a simple bandpass filter that’s at least stereo and ideally polyphonic and doesn’t take up too much space in a rack. Or maybe a module that has multiple of them. RJModules Filters has the right UI idea but it’s mono and the documentation is sketchy so I don’t know what’s in it.

I guess SurgeBiquad does this (though it’s wider than I’d like), but SurgeEQ looks kind of similar and has three of them, maybe? What’s the difference between a filter bank and an equalizer anyway? My search on “how does an equalizer work” finds articles that say what it does, not how it works, but I assume it’s made out of filters somehow.

Wide (14hp) but Blamsoft F-35 has a range of filters to choose from and is stereo. There is very little difference with mono or stereo when in the context of Rack, you can easily make a mono signal stereo by duplicating and panning left + right respectively.

You may have a look at several filters in the VCV source: TBiquadFilter https://vcvrack.com/docs/structrack_1_1dsp_1_1TBiquadFilter

IIRFilter https://vcvrack.com/docs/structrack_1_1dsp_1_1IIRFilter

https://vcvrack.com/docs/filter_8hpp_source

They can be stringed together. Also it’s relative easy to “break them out” and give each of the Biquads a little module.

filters

(unpublished and not stereo/polyphonic, but that seems doable also.)

Ingo

The reason I like stereo is not that I care about stereo, but because you can apply the same filter to two different audio signals. Polyphony is even better.

Surge biquad is really only wide because i have buttons for each filter type. If you look at the code it’s really easy to change that control to - well - anything else really. Or even just make a biquad of a particular form. The code is all GPL3 and easy to push around at this point.

Biquads are really good for fixed filter banks. The have accurate frequency response, low noise, and are pretty fast to compute. The only downside is that it usually takes a lot of CPU to re-calculate the filter coefficients if the Fc or Q is modulated.

2 Likes

The documentation for the Teensy audio library’s biquad filter says it’s not recommended below 400 Hertz due to numeric precision. I think it might be because it’s using 32-bit floats, though. (That’s all the hardware supports for the microprocessor I’m using.)

I found VCV Rack useful for testing my synthesizer code running on the device. I have a patch that just routes the audio input on my Mac to the scope and frequency analyzer modules to get a live look at what it’s doing. (I suppose I should get some real oscilloscope software, but this is more fun.)

Probably. I use 64 bits when Low Frequency is required, like the DC blocking filters in my waveshaper “Shaper”. 32 will got a small amount of noise at very low frequencies. I supposed the frequencies are off a little, too, but I’ve never looked into that.

I’ve been reading signal processing texts and thought of a silly filter trick: take a clock generator, set the pulse width as narrow as possible. Send it through a filter and then to an oscilloscope. I think you get something close to the impulse response?

I wonder if there is a module that will generate a pulse one sample wide and a scope that will display individual sample points?

As a hack, you could take some gate signal, delay it by one sample (with a multiple or something), and pass it through a X AND NOT Y gate logic.

1 Like