Friday, August 10, 2012

A filter experiment

Last month’s post included the following graph showing the frequency response of the Matrix-1000 VCF at different levels of resonance plus the extra harmonics caused by the filter non-linearities (the graph has also been adjusted to remove the effect of the resonance-dependent CEM 3396 gain correction):

FilterResonance4

As a first experiment to implement the filter digitally, I coded the digital equivalent of the ideal low pass filter without a resonance parameter and I added the resonance to it by feeding back the amplified filter output to the filter input (mixed with the input signal). This configuration mimics the analog design of the filter.

I used the simplest possible model for the nonlinearity that I could think of, passing the input to the filter through a waveshaper. The waveshaper uses a sigmoid function that is not centered around y=0 to be able to produce both even and odd harmonics.

This is the output of the resulting digital filter when feeding white noise to it, again for different levels of resonance:

FilterResonance5

Not saying this is perfect, but the graphs show that this simple model already gets close to reproducing some of the observed filter behavior by using a digital filter.

This implementation has some potential issues:

  • The feedback loop that generates the filter resonance is instantaneous in the analog filter, but it has a one-sample delay in the digital implementation. While there might be ways to avoid this, it’s probably not a big problem: The main effect is that the resonance frequency doesn’t match the cutoff frequency of the low pass filter sections (as it does in the analog circuit), but the solution is to modify the cutoff frequency of the low pass filter so that it results in the desired and correct resonance frequency. A table or interpolation formula can be used to compute the amount of adjustment needed.
  • In the analog circuit, there are nonlinearities in each electronic component, not just in a single place. More experiments and listening tests will be needed to find a compromise. For example, splitting the digital 4-pole filter in four single-pole sections (like in the analog implementation) and adding a nonlinearity to each section should already result in a warmer sound.

Using white noise as a the filter input is not ideal as it doesn’t give enough information about how the filter responds to transients in the input signal. My current plan is to focus on the DCOs first. Once the digital square wave is virtually identical to the analog waveform, it can be used to drive the filter and further study and refine its behavior.
There is a circular dependency here, as in the Matrix synthesizers the output of the DCOs always goes through the filter, so it’s not possible to record the unfiltered square waveform and to be able to compare the real and digital waveforms, the digital implementation needs a filter, too. Luckily the effect of the filter can be minimized by setting the cutoff frequency very high, and a simple digital filter is already very close to the analog one when the resonance parameter is zero. In other words, I can use the simplified digital filter I already have to perfect the digital DCOs, then once I have the DCOs I can use them as input signals to improve the nonlinear behavior of the filter.