troisiemetype / teensymoog

40 stars 9 forks source link

TeensyMoog

teensymoog 1 teensymoog 2

What is it ?

Teensymoog is a synth, inspired by the legendary minimoog.

It aims at looking and functioning as close as possible of the orinal, but using digital tools, namely Teensy and Arduino boards.

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.

How it's made :

It's based on a Teensy 4.0 running the incredible audio library by Paul Stoffregen of PJRC.com.

The whole interface (minimoog_teensy/audio_setup.h) has been developped with the associate visual online audio system design tool

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

Dependencies

Apart from Teensy audio, this program uses a few libraries. Arduino Midi library by FortySevenEffects, for internal communication between the boards. It's the one implemented by Teensy for usb MIDI, very complete.

PushButton is used to debounce all switches, and detect changes.

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.

Function implemented

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

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.

Noise

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.

Mixer

The mixer is copy-paste on the original minimoog : a potentiometer for each of the five channels, and a switch for rapid on / off.

Filter

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)

Envelope generator

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.

LFO

There is a LFO available, with continuous rate and waveform selection.

Modulation

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.

Function settings

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.

Keyboard priority mode

Function + C

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.
  2. first note priority : a note will be played only if no note is already playing.
  3. last note priority : a note will be played anyway.
  4. 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.

Note retrigger

Function + D

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.

Keyboard detune

Function + E

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 :

  1. off : perfect pitch for each key
  2. soft : lightly detuned, +-10% of a semitone
  3. medium : a bit more detuned, +-30%
  4. hard : play drunk, two adjacent notes can almost same the same, +-50%
  5. reset : this generate a new random detune table. The detune table stores a fix detune coefficient for each of all 128 MIDI notes.

Bitcrush

Function + F

Output resolution can be changed. The default is 16 bits, but any bitsize between 4 and 16 can be choose. The bitcrushing is applied at the end of the audio stream, just before the i2s / USB output.

Filter mode

Function + G

The filter band knob slides continuously from low pass to high pass. It can be choosen wether :

MIDI channel setting

Function + A for MIDI in

Function + B for MIDI out

The MIDI channel the synth listens and emit on when connected via USB can be changed. Any channel from 1 to 16.

Pitchbend range

Function + pitchbend wheel move

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.