It uses three boards, one Teensy 4.0 that handles the heavy computing (sound generation), and two Arduino Mega (chinese copies in a small form factor), that are used as "port expander", which read keys, switches and potentiometers and send their value on change to the Teensy.
It's based on a Teensy 4.0 running the incredible audio library by _Paul Stoffregen_ of [PJRC.com](https://www.pjrc.com/teensy/td_libs_Audio.html).
The whole interface (`minimoog_teensy/audio_setup.h`) has been developped with the associate [visual online audio system design tool](https://www.pjrc.com/teensy/gui)
Two Arduino Mega pro are used to poll all the switches and potentiometer and sending any update to the teesny. The communication between the boards uses MIDI messages, mainly control change (or continuous control) messages. I've tried to stick as close as possible to the MIDI specification, and using the existing and available control numbers. There are cases where it's not the case (_e.g._ filter cutoff frequency uses a two bytes control change to increase resolution).
A Pimoroni's phatDAC is used to output high quality audio from the i2s stream generated by the audio library. A USB B port is mounted on the rear panel so the synth can be connected to anything, as a USB midi device or USB audio device (not available in Arduino IDE for Teensy 4.0 yet, but I know it will come !). There is also provision for (not implemented yet !) MIDI in and out (DIN-5 pins, but maybe 3.5 jack would be a better idea) sustain and expression.
A smartphone charger has been repurpose as the main adaptor.
The enclosure has been made out of would and acrylic.
The base plate is made of plywood. The mains parts are made of walnut, from a table I found in the street two years ago. For a long time I wanted to repair it, but I didn't like its feet, so this is a good opportunity to make room in there ! The wood has been treated with tung oil, wich gives a soft and smooth finish that I really love.
The main and lateral control panels, control panel bottom and rear enclosure are made of 2mm acrylic (PMMA). It has been cut and engrave with a CO2 laser cutter. The engravures are filled with white paint. SVG files for the panels are included in the repository.
There was no sketch made for the walnut enclosure, but I should have done some : it's quite thin (around 7cm tall), and it gave me headaches to integrate some components in it. There is plenty of room, but I had to change things several time to accomodate the keyboard height, the front panel with sontrols and the rear panel with plugs...
Apart from Teensy audio, this program uses a few libraries.
[Arduino Midi library by FortySevenEffects](https://github.com/FortySevenEffects/arduino_midi_library), for internal communication between the boards. It's the one implemented by Teensy for usb MIDI, very complete.
[PushButton](https://github.com/troisiemetype/PushButton) is used to debounce all switches, and detect changes.
[expFilter](https://github.com/troisiemetype/expfilter) is used to smooth ADC readings. It gives a result close to a running average, but without the need of big tables to store results.
As said above, the goal is to have something looking as close as possible to the original Minimoog.
The keyboard is smaller, 2 1/2 cotaves instead of 3 1/2 (or 30 keys instead of 44), not by choice, but because the _Bontempi_ electric organ it cames from.
### Global description
It has three oscillators, a mixer section with noise and feedback (post-filter output is re-fed to the mixer), a filter, two envelopes generator for filter and notes, a LFO, a pitchbend wheel and a modulation wheel.
Oscillators have each six waveforms to choose from, six frequency range (or octave transposition) and osc. 2 & 3 can be detuned by +- 1 octave regarding the base note. Osc.3 can be disconnected from the keyboard control, and used as a drone.
There is one noise source, with pink and white noise.
### Feedback
The original minimoog has a external input mixer entry, so anything (guitar, another synth, etc) could be processed through the mixer. It was often used as a feedback path by plugin the headphone jack back into this input. The minimoog reissue has hard-wired this by connecting the output to this external input internally when nothing is connected to the jack.
Maybe external input will be implemented once, but I wanted this feedback.
The filter is (I believe) close from the minimoog one. Cutoff frequency and emphasis (resonance) are available. Their is an associated envelope generator that modulates the cutoff frequency. Their is also an addition compared to the minimoog : there is a knob to slide continuously from low pass to band pass, to high pass filter. It can also slide continuously from low pass to high pass, thus resulting in a band stop filter at mid-course. (see _functions_ above)
There are two envelope generators : one for the filter, the other for the global sound shape. On the original minimoog, decay can be used (_via_ a switch) to add release to notes. On this one a knob is there for, so this is a classic ADSR envelope.
The modulation can be applied to oscillators and or filter, and is controlled by the modulation wheel. Four modulation sources can be used, and mix together. osc.3 or filter envelope can be mixed to noise or LFO.
### Glide (portamento)
Portamento can be from 0 to ten seconds, and switch on and off.
### Octave transpose
There is +- 2 octave transpose available to compensate the only 2 1/2 octave from the keyboard.
There are "hidden" settings available through a function switch. When turn on, the keyboard can be used to change the behavior of some things. Each of this setting is saved when power is turned off.
The first octave of the keyboard is used to select the setting to be changed, then keys from the second C used to set the new value.
This defines the way the keyboard behave. There are four mode available :
1. lower note priority : a note will be played only if it's lower than the one already playing.
1. first note priority : a note will be played only if no note is already playing.
1. last note priority : a note will be played anyway.
1. upper note priority : a note will be played only if it's upper than the one already playing.
In any case, ten notes are tracked, so when several key are pressed releasing a key will play another, according to their position or the order they was pressed.
This defines how a new note is played. If some keys are already pressed when a new note is played, it can retrigger the envelopes, or let them to their state. This can be turned on or off.
The original minimoog has a resistor ladder keyboard, which implies small variations in tonality regarding a perfect pitch. This setting reproduce this by applying detune to each note and letting you choice :
* it slides from low pass to band pass for the lower half (high pass cut), and from band pass to high pass in the upper half (low pass cut), or
* it slides continuously from low pass to high pass, thus resulting in a band stop filter when knob is centered. (well, kind of : having a true band stop filter would mean to mix two different filters with frequency offsets. Here they overlap.)
The amount the pitch wheel bends a note above or bellow the note being played can be changed semitone by semitone.
#### Modulation range
_Function + modulation wheel move_
As well as the pitch bend range can be changed, so does the modulation range. Pressing any key will set this interval according to second C, for the modulation applied to oscillators. Modulation applied to filter can be changed as well, by pressing second C before to set the new interval.