EP-MK1 is a real-time physical model of an Electric Piano made with Pd and Camomile.
While researching for a way to emulate an TR-808 style bass drum for my drum machine project, I stumbled upon Kurt Werner’s paper on the digital model of the Roland TR-808 Bass Drum and the Overview section stated the following:
A bass drum note is produced when the µPD650C-085 CPU applies a common trigger and (logic high) instrument data to the trigger logic. The resulting 1-ms long pulse is delivered via the pulse shaper to the bridged-T network (a band pass filter), whose ringing produces the core of the bass drum sound.
It’s nothing new that you can create bass drums using resonant filters. I’ve seen it in a bunch of DSI Tempest and KORG MS-20 tutorials. But, I had yet to see it successfully implemented in a Pure Data patch.
As I tested the core algorithm, I found that not only did this produced a natural decaying sine wave, it also has less decay on higher frequencies, just like a Rhodes Piano would do.
2. Core Algorithm
To achieve the core algorithm of an electric piano we require a resonant band-pass filter with Cutoff and Q controls running at audio-rate. Personally I took an abstraction from the heavylib repository (hv.fillter bandpass1) and made it audio-rate compatible. You can download this filter here: rbpf~.pd
It is important to set the Q to a high value like 1500 to obtain a longer sustain. After that we need a pulse going from 1 to 0 in T milliseconds, T being the period of our set frequency (f). To get T we divide 1000 (miliseconds) by f (in Hz). This is needed in order to obtain a normalized amplitude in each note.
Then to get a consistent transient on each trigger we need to clear the internal state of the filter to zero. Luckily this filter runs on objects like [czero~] and [cpole~] which already have that function, we just need to send a bang to the fourth inlet of the filter.
You’ll notice that we get clicks when triggering consecutively, this can be solved by adding a delay of 1.5 ms to trigger the pulse and resetting the amplitude. Next step should be mapping the incoming midi note to f and the note on/off to trigger the pulse/ mute the note. The core algorithm should look something like this:
3. Pulse Shaping
In this algorithm the pulse is equivalent to the hammer of an electric piano. You can notice that in most electric pianos you get a clear tone when played soft and a more “growl” sound when played hard. To achieve this, we need to control the amplitude of the pulse with our midi velocity (v). In this case I modified pulse’s level with this formula which ranges from -24 dB to 0 dB:
Personally, I combined the pulse with another white noise pulse with the same duration to get a more natural attack. This, along with a low-pass filter gives a more warmer and complex transient.
4. Pickup Model
Our pickup model consists of a parallel layer of asymmetrical distortion. This type of distortion can be achieved by offsetting the signal before going to our distortion module (hyperbolic tangent), this way our sine wave resembles more of a pulse wave producing even and odd harmonics rather than just a square wave with odd harmonics.
We also filter the incoming signal with a low-pass filter to dampen the harmonics on higher frequencies. By adding another parallel distortion layer processed by [pow~ 10], which raises the signal to 10, we can highlight the even harmonics. It is important to invert the phase of this layer to avoid cancellation. Finally both of these layers are leveled to taste and sent to a high-pass filter to remove the D.C. (offset).
This algorithm is very close to a Rhodes Electric Piano, but still has some room for improvement. The patches shown on this documentation are available in the Patchstorage download.
- Kurt James Werner. A Physically-Informed, Circuit-Bendable, Digital Model of the Roland TR-808 Bass Drum Circuit.
- Florian Pfeifle. Real-time Physical Model of a Wurlitzer and Rhodes Electric Piano.
- M. Muenster and F. Pfeifle. Non-Linear Behaviour in Sound Production of the Rhodes Piano.
- Kees van den Doel and Dinesh K. Pai. Modal Synthesis for Vibrating Objects.