MCO – Analog Modulations (CV)

Generally, in an analog synth you can find lots of analog sources of modulations (LFOs, envelope generators, etc..). Providing multiple inputs for analog CV modulations is one of the requirements.

This is easy, as a simple OpAmp mixer will perfectly do the trick. The problem is that the sum of all these modulations is going to be fed to the microcontroller’s ADC input, which does not tolerates voltage lower than -0.5V and higher than 5.5V. Asking the designer/user to limit the input to these voltages is risky, as a combination of small values could lead to potentially harmful voltages (for the chip, not for you :p).
Just after the input mixer is a limiting stage, using two Zener diodes to clip the voltage. I found that low voltage zener can be harder to find, so the mixer actually boosts up the signal (2.2 gain) and gets clipped by 5V Zener diodes (so that the signal after limiter stage is between -5V and +5V).
To keep the 1V/Octave scale, we need to scale down by the same factor after limiting. An inverting OpAmp with a 1/2.2 gain will do the job, with an additional 480K resistor to -12V to inject a -2.5V offset, which is going to be inverted to centre the whole signal around 2.5V.
Here we have a 1:1 scale between the inputs and ADC signal. but we could accept any range (let’s say -5 to +5 volts, for a larger frequency sweep) for the inputs, and by changing the mixer’s gain and ADC representation, have a different range of modulation. So far it’s set to -2.5 to +2.5 to simplify the calculation for the DAC.
The DAC will convert the input voltage to a 10bit value (0 to 1023), centred to 512 when all the inputs are grounded. In the code, these values will be rescaled to match the number of cents to detune from the base frequency.
For example, with a direct 1V/Octave scale (-2.5 to +2.5 octaves), the highest pitch will be 2.5 * 100 * 12 =3000 (100 cents in 12 semitones times 2.5 octaves). So the ADC input will be scaled to -3000 to +3000 cents. The step (precision) will be (2 * 3000)/1024 = 5.86 cents per ADC step. For that reason, it’s preferable to use the digital control to set a precise frequency, and use modulation for dynamic signals (like vibrato or envelopes).

MCO – Specs & Processor

The Mixed Control Oscillator is inspired by Tom Wiltshire’s (aka Electric Druid) article on how the Roland Juno series DCO (Digitally Controlled Oscillator) work.

It’s called Mixed Control because it’s capable of both digital and analog control.

Digital control is done with an SPI interface (this is very common, you can find one on almost every microcontroller these days, including the Arduino, Propeller and LaunchPad).

Analog control uses the 1V/Octave scale, meaning that increasing the input modulation voltage by 1 volt will double the output frequency. It is limited to -2.5V to +2.5V of range so far (meaning 2.5 octaves below the base frequency, given by digital control, to 2.5 octaves above).

The central part of the MCO is the microcontroller (the Driver), that does the following:
  • Read SPI messages to change the base frequency (among other commands)
  • Read analog input to modulate this frequency
  • Generate the clock and slope signals, needed by the Saw generator.
  • Handle a few other features, like
    • Portamento
    • Hard Sync
The microcontroller is an ATtiny84 from Atmel, programmed with C/C++ code (which is going to be published soon).


It uses the internal 16 bit timer to generate the clock, and a 8bit timer to generate the slope (which requires less precision as it sets the Saw amplitude). These timers (and the whole microcontroller) are clocked using a 16MHz quartz.

Digital control handles the following control messages:
  • Change coarse base frequency, as MIDI notes (semitones)
  • Change fine base frequency, as MIDI notes + 1 to 99 cents detuning (semitones + cents)
  • Set Global detune frequency (the frequency for A4 is default 440Hz, but it can be set to anything else).
  • Portamento settings
    • Mode: Constant time or constant speed (more about that in a dedicated post).
    • Amount
  • Enable/Disable some features on the fly
    • Hard sync
    • Analog modulation
    • Digital lowpass filter on modulation
Analog modulation uses the internal 10bit ADC (Analog to Digital Converter). The signal is centred on 2.5V, so that positive and negative modulations (around the base frequency) can be achieved.

Hard sync can be done using an interrupt pin. When the sync pulse occurs, the timer resets, and a new waveform cycle begins.

Next time: Analog input.

Opening the Mixed Control Oscillator

I recently read this article on Make: Magazine about the “unspoken” rules of Open Hardware.

The MCO is not quite finished, but I guess it would be selfish to only post updates on this blog without revealing how it actually works..
For that reason, this project is now under the CC-BY-NC-SA license. For those who are not quite familiar with licenses, I invite you to click that button:

In other terms, you are free to do whatever you want with this project, as long as you mention its source (either a link to the Forty Seven Effects blog, or mention my name), and as long as you do it for personal use only. If you want to sell a project that uses it, feel free to contact me.
Explaining everything into one blog post would be long and boring, so I’m going to split the things to facilitate the reading.
Next time: Reminder of the specifications, and the central processor.

MCO Driver using an ATtiny 84

I’ve been working on the Mixed Control Oscillator recently, it will be using an ATtiny 84 AVR chip from Atmel in the final form factor (so far it’s been running fine on my dev board using an ATmega644P, which is a bit overkill for such an application).


Here are the final specs:

For the driver itself (the AVR chip):
  • Precise control of the frequency via SPI. It is based on the MIDI note numbers, but with every cent between two semitones being accessible (1 cent precision), allowing frequency sweeps and continuous digital modulation.
  • Analog input for modulations (1V/octave, 5 octaves range).
  • Global detune (from reference A4@440Hz, with 1 cent precision).
  • Portamento (work in progress), with two modes: constant time & constant slope.
  • Hard sync input & output.

For the analog part:
  • Saw, Pulse and Triangle outputs.
  • PWM inputs.
  • Special triangle mode where the slope follows the PWM (work in progress). This would allow smooth transition from saw/ramp to triangle using PWM.

The ATtiny84 on AVRFreaks: http://bit.ly/vlMpsp