fake class D amplifier patch

Monotrail’s recent video on the AtoVproject cDVCA impressed me, and got me thinking about picking up the module but also left me wondering: can I replicate this myself?

A Class-D amplifier uses PWM (pulse-width modulation) instead of variable voltage to set the level of an amplifier. The idea is that it switches on and off at well above audio rate, using the width of pulses to determine how loud the output is. Narrow pulses mean it’s on for less time on average, which mean it’s quieter; wide pulses mean it’s on for more time, which makes it louder. There are also PWM dimmer controls for lights, fan speed controllers, etc.

We can do that with a VCA in a synth patch too. You need:

  • A sound source
  • A fast oscillator capable of PWM, or a fast triangle oscillator and a comparator.
  • A fast enough way to switch the sound on and off.
  • A lowpass filter.

Here’s my patch in Bitwig Grid:

Here, the sine oscillator is the source. I’m using a triangle oscillator at a ratio of 99x the incoming MIDI pitch, biasing it so it’s unipolar (positive only), and then comparing it to the output of an envelope generator. The higher the level from the envelope, the wider the pulse width will be, thus the gate will be open more.

I admit this patch is cheating a bit. A real class-D amplifier doesn’t have a filter there — it would strictly gate the incoming signal on and off, and then filter it after the gate. However, Bitwig’s oscillators don’t run fast enough to do that very well. So the filter is turning the pulses into a smoothly running “voltage” to control an ordinary VCA.

The point of this indirect method is to add some dirt. The more you open the filter, the more dirty and digital and aliased it gets. Lowering the frequency on that triangle oscillator — and optionally making it follow the pitch of the input signal — can create some really neat, dirty variations on AM (amplitude modulation synthesis).

Don’t get me wrong, I haven’t talked myself out of the actual module yet! It does the class-D thing the proper way, and in a convenient form, and with a cool drive circuit. And being able to use it directly in Eurorack without the latency of crossing over to the software side has some advantages.