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).