Reverse-Forward Filter Design

Jatin Chowdhury
4 min readAug 24, 2024

--

A few months ago, I was working on a model of the Zen Drive guitar pedal when I ran into an interesting filter design problem.

I was attempting to train a machine learning model of the pedal, however, the pedal has 4 “knobs” that the user can use to modify the pedal’s sound: “Voice”, “Gain”, “Tone”, and “Volume”. In my experience, training user controls into a machine learning model typically requires a larger model (which means more computation), and doesn’t always train to the same level of accuracy as a model without the user controls. With that in mind, I had a look at the pedal’s circuit schematic to see if any of the controls could be removed from the model.

The circuit schematic for Aion FX’s “Azimuth” pedal, which is closely based on the Zen Drive.

The Volume control is connected to a simple volume potentiometer, so I figured I could train the model with the Volume control set to max. Then when implementing the model, I could add a simple DSP-based volume control to achieve the same effect. Unfortunately, the Gain and Voice controls are not so easy to “extract” from the circuit, and would need to be trained into the model. But what about the Tone control?

The Tone circuit from the Azimuth pedal.

The Tone circuit for the Zen Drive comes just before the pedal’s output circuit, and is a simple “RC Lowpass” filter. This circuit is easy enough to model with a generic first-order lowpass filter, so it might seem that we could add this filter to our model similar to the way that we treated the Volume circuit, however that doesn’t quite solve our problem. Let’s say we train a model of the pedal with the Tone knob turned all the way up. Even at that setting, the Tone circuit will still have an affect on the sound, which will be learned by the model. Therefore, directly implementing a Tone circuit filter as an extra part of the model will have the same effect on the sound as if the pedal had two Tone circuits.

So really want we want to figure out is how to “undo” the effects of the Tone circuit in the pedal (at the max setting), and then re-apply the effect at whatever setting the user has chosen.

Derivation

A simple “Laplace Domain” analysis of the Tone circuit reveals the filter’s “transfer function”.

In this equation “C” is the value of the capacitor “C4” from the circuit shown above, while “R” is the combination of the “R4” resistor, plus the current value of the “Tone” potentiometer. The frequency response of the filter is shown below.

Frequency Response for the Tone circuit filter.

We could attempt to “undo” the filter by inverting it, but that would lead to a couple of issues. First off, inverting the filter would result in an unstable filter. We could try to derive a stable filter that approximates the true inverse filter, but that would still mean amplifying frequencies that had been cut by the original filter, which usually results in a very noisy signal.

Instead, we can invert the filter and simultaneously re-apply the filter with a new Tone control value. For lack of a better name, I’ll call this the “Reverse-Forward Filter”. The transfer function for this filter would be:

In this equation, “R0” would be the “R” value for the filter being inverted (in this case the value when the Tone knob is set to max).

The frequency response for the reverse-forward filter.

As expected, at the maximum Tone setting, the reverse-forward filter becomes an all-pass filter. For the other values of the Tone potentiometer, we can plot the original Tone circuit frequency response against the full frequency response of the original Tone circuit (at the max Tone setting) followed by the reverse-forward filter, to check that the responses match.

Comparing the frequency response of the original filter to the model/reverse-forward filter.

Conclusion

At the end of the day, this isn’t a particularly challenging filter design problem, but it’s a fun little bit of math, and I think it’s useful for showing how more traditional signal processing can be used in combination with machine learning methods, to reduce the complexity of the problem that the machine learning model is required to solve.

I should mention that the Zen Drive circuit had two particular characteristics that allowed this trick to work. First of all the Tone circuit comes after the nonlinear Gain circuit… if the Tone circuit were placed in between two nonlinear circuits, then applying the reverse-forward filter would not have had the same effect. Second, the Tone circuit for the pedal is quite simple, and is easy to analyze and invert. If the circuit were more complex then the process of designing the reverse-forward filter could have been much more complicated.

--

--