Edit: This is just the first part of my monotron mod. For more information and links about what it’s all about, you can jump here.. otherwise, continue in this meaty post.
This is a description of how you can easily add MIDI to a Korg Monotron using a Teensy 3.0.
The objective here is twofold: First to provide an easy way to control the Monotron’s pitch and filter cut-off via MIDI, then provide an easy open-source extension framework to the Monotron’s capabilities using the Teensy as main MCU.
Since I’m relatively new to this topic, I’ll also try to add extensive information on the process so that it can hopefully help people in the same situation.
I’m extremely grateful to the people that directly – or indirectly – helped me to achieve this through thorough documentation of their projects or by answering my noobish question. Olivier Gillet (Mutable Instrument), Paul Maddox (Vaco Loco) and Tony Hardie-Bick and Collin Cunningham – A huge thanks to all of you.
If you know Teensy/Arduino and basic electronics, you should directly grab the schematics and the teensy code over here.
Surprisingly, although the schematics for the monotron have been out for a long time, most of the monotron ‘hacks’ I could find are pretty limited. Either they are intended to CV control which – not having any modular – didn’t appeal to me much or provide a simple, direct midi control of pitch. On top of that, all MIDI kits are closed source so people can’t start building on the existing expertise.
After trying to dissect the ways the shruti-1 worked, it seemed obvious that when driven from an MCU, controlling an analog oscillator/filter could go a lot further than a simple one to one MIDI mapping and I decided to explore the possibilities this cheap unit could deliver.
Out of the box
The first thing to do is to allow some connection to the soldering points Korg gently left for us to use as external control. The easiest way to do that is to solder a series of cable to some kind of breakout box that will allow us to plug or unplug the controlling MCU at will.
This is an extremely well documented video from Collin Cunningham explaining how to do this, so I won’t re-explain it all. After doing this, you will have four wires coming out of the monotron, allowing you to connect an external circuit to pitch control, cut-off control, gate and ground. Even better, this is completely non-destructive – the monotron will continue to work exactly like before.
Choosing the MCU
When selecting the unit that will drive the monotron, I wanted to have something as simple as possible. There are tons of them out there but I wanted something that I could program easily and bootstrap quickly in order to concentrate on the task itself. The arduino could have been a choice but the Teensy 3.0 looked even more appealing. Extremely small form factor, cheap, runs up to 96Mhz and, most importantly, has a build in usb class compliant MIDI mode that provides direct MIDI compatibility without having to do any work.
To control the monotron, we need to generate 3 different signals: one for the Gate (that lets the oscillator signal feed the filter), one for the pitch of the oscillator, and one for the filter cut-off frequency. All those signal are within the range of 0v-5v which is precisely the type of voltage the teensy can deal with.
The gate is the easiest one. It expects 5v to open the gate and 0v to close it, which is exactly what the Teensy’s digital pin will do.
For the pitch and filter cut-off signals, we need to generate a DC signal that varies somewhere between 0v and 5v – depending on how high we want the pitch/filter frequency to be. To do so, we have two alternative: either use the onboard PWM of the teensy (see here for a description on how PWM works) or use an additional DAC. The onboard PWM is an easy option, but it is restricted to a range of 255 values. This is somehow fine for the filter cut-off but won’t be very precise for pitch tracking. One can then decide to either use a reduced octave range and use PWM or use a higher precision DAC.
Not knowing upfront how much tweaking would be needed to ensure correct pitch tracking, I decided to use a 12-bit DAC. More so, since I was going to have a DAC, I decided to use a mcp4822 that provides 2 seprate 12-bit dac in one chip. That way I can use the second channel to generate digital audio from the Teensy itself and add extra digital oscillators to the monotron using the same setup.
Making the connections
1. The Gate:
As we saw already, connecting the gate a as simple as connecting one digital pin of the teensy to the gate input in our monotron breakout-box. In our case, we’ll choose the teensy’s pin 5 to control.
2. The Filter cut-off
Since we decided to control the cut-off using PWM, we need to take care of the fact that we will generate a high frequency variable pulse signal that we want to somehow ‘average’ to a constant DC value using a low-pass filter.
It is usual to use a fairly high carrier frequency for the PWM (in this case I’m using 31250 Hz on the teensy’s Pin 3) and apply changes to it at a much lower frequency (we’ll use 800Hz) so that the high frequencies of the carrier can be attenuated enough through a simple passive RC filter. Looking at the schematics, this is achieved by the R3 and C1, which give us a low pass with a cut-off frequency of about 723Hz.
Also, the monotron doesn’t use the full 0v-5v range for CV control of the cut-off but a lower range. Since the Teensy can only generate either 0v or 5v, we’ll need to lower that voltage using a voltage divider. This is achieved by R1/R2 which will divide by a factor of two the voltage generated by the Teensy.
Finally, we’ll need somehow to accomodate the monotron’s expectation in terms of impedance. Looking at its schematics, the voltage we’ll apply is taking an equivalent path as the LFO cut-off control and since that one is regulated through mR44 (I’m using the m prefix here because I’m referring to the monotron’s schematics), we’ll mimic this behavior and add a 10K (R4) resistor too.
Since we decided to control the Pitch using a DAC, we won’t have PWM components in it but we still might have some high frequency noise liked to the DAC’s operating frequency (44.1Khz). To be sure we have a clean signal, we will filter the DAC’s output pretty much the same way as the filter cut-off,provide a stable output voltage using R5/C2. Since the pitch is also fed to the monotron the same way as the internal LFO is and we’ll need to provide a resistor equivalent to mR4, which in our case is R6.
At this point, we have pretty much all of our schematics ready. All we need is to add the SPI connection between the teensy and the mcp4822 (so we can control it) and add the various ground and 5V connection.
We can now start programming the Teensy to send values to the monotron’s pitch and cut-off. However, unless you are extremely lucky, it is most likely going to be out of tune since you don’t know what value you need to set the DAC to in order to have the monotron to produce semi-tones. We end up with something that reacts to not but isn’t properly tuned like this:
So we need a way to calibrate our DAC output.
The easiest way I found was to use Live 9 and comparing the monotron’s output with an instance of Operator using 4 sine one octave apart each, playing a single constant C note. This would lead to a nice identifiable spectrum location
Since I can use MIDI to control the monotron, I generated C notes octave apart and used the pitch bend to calibrate the note frequencies until the spectrums matched nicely
This method has the double advantage of providing a direct ‘rough’ visual cue of where the peaks are located but also generate beats between the monotron’s oscillator and Operator’s when the frequency gets closer providing a more precise cue as how close the frequencies are.
After calibrating the DAC’s output that way, we end up with a nice tuned range across 4 octaves (C0-C4)
The good news is that the voltage control needed by the monotron is nicely linear and there’s no real need to start correcting the pitch inside the teensy. Note also that since the pitch and cut-off knob of the monotron are still active, the result is going to be dependent of those. I end up setting the VCO pitch pot somewhere around 9 o’clock and the cut-off at 12 o’clock.
In the end, we have a nicely controllable unit that is completely sequencable from within any MIDI sequencer.
Code and schematics
I’ve made an archive containing both the schematics and the teensy code. The teensy code is separated in two different file. One – hardware.ino – containing the code dealing with the hardware setup and Pin/DAC/PWM control. The other – monotron_control.ino – hooks up the midi received by the teensy’s usb port to the hardware control. Hopefully it’s simple enough to be understood but if needed, I might go more in detail in a later post.
You can grab a zip file over at github.
From here, you got software control over pitch and cut-off. It’s easy to add more code to provide various LFO’s, envelopes or use the first DAC channel to generate additional oscillators fed to the monotron through the aux input….