This project uses a specific configuration of the Arduino Mozzi Additive Synthesis project to create a “synth strings” type sound based on detuned sawtooth waves.
Warning! I strongly recommend using an old or second hand keyboard for your MIDI experiments. I am not responsible for any damage to expensive instruments!
These are the key Arduino tutorials for the main concepts used in this project:
If you are new to Arduino, see the Getting Started pages.
Parts list
- Arduino Uno
- 1x 270Ω resistor (optional)
- 1x 100nF capacitor (optional)
- Amplification
The Circuit

This is pretty much the same hook-up as we’ve used with every Mozzi project so far, but I’ve explicitly diagramed the recommended Mozzi output stage consisting of a 270Ω resistor and 100nF capacitor.
As always, MIDI input goes to the RX pin of the Arduino.
The Code
I’ve used the same basic code as the Arduino Mozzi Additive Synthesis project but with the following enhancements:
- There is now a (hard-coded) choice of base waveforms by setting the WAVETABLE parameter at the top of the code to one of 0=Sine; 1=Triangle; 2=Saw; 3=Square.
- I’ve added the option to disable any of the potentiometers by defining POT0 to POT5 to a hard-coded value. POT0 chooses the pattern of harmonics to use. POT1 to POT5 sets the gain level for each of the harmonics.
- I’ve added the option to detune any of the harmonics in 1Hz units.
To get my string sound, I’ve preset the following:
#define POT0 0
#define POT1 255
#define POT2 0
#define POT3 255
#define POT4 0
#define POT5 0
#define WAVETABLE 2 // 0=Sine; 1=Triangle; 2=Saw; 3=Square
In addition I’ve changed the first set of harmonics to be repeats of the fundamental, but added detune options as follows:
int waves[NUMWAVES][HARMONICS] = {
{1, 1, 1, 1, 1},
...
};
int detune[HARMONICS] = { 1,2,3,4,5 };
As you may notice, I’m only actually using two of these additional oscillators, those detuned by 1 and 3 Hz (as defined by POT1 and POT3).
I’m pretty pleased with the results.
Closing Thoughts
Whilst I was attempting to find a hard-coded string-style sound with this project, I’ve left it open for a lot of experimentation.
Re-enable the pots and then try the other waveforms, different detuning options and different harmonic series. It might be nice to make the detuning an option (maybe enabled with a button) or have a way to choose the waveforms too, maybe using more buttons or some kind of selector switch.
Kevin