Build the "REMI Synth" (mk2)
A DIY Project by M.J. Bauer
This post describes the design of the "second generation" (mk2) REMI synth module.
The REMI Synth Module is a monophonic MIDI-controlled sound synthesizer designed primarily for use with electronic wind instument (EWI) MIDI controllers, in particular the REMI mk2 handset.
Provision of a standard 'MIDI IN' port allows the synth to be played by any MIDI controller, for example, a keyboard or another EWI with a standard MIDI output. Using a low-cost MIDI-USB adapter, the REMI synth can also be controlled by a computer running music software, for example a MIDI sequencer.
Right-hand side connector panel
The REMI synthesizer is implemented almost entirely in software, requiring minimal circuitry outside of the PIC32 microcontroller - just a low-pass filter in the audio output circuit. To generate audio tones, the synth uses a dual "wave-table oscillator" algorithm offering a variety of waveforms which can range from very simple to rich and complex sounds, some resembling acoustic instruments.
A PIC32MX340 processor clocked at 80MHz allows a sample rate of 40kHz with 11-bit precision of PWM audio output. Internal DSP computations use 32-bit fixed-point arithmetic resulting in high quality sound.
For clarity, the diagram omits the LFO, envelope
shapers and audio attenuator.
The synth model comprises a pair of wave-table oscillators which use independent wave-tables. The two oscillator outputs are fed into a "mixer" which scales and adds the two signals in a variable ratio. The mix ratio can be fixed, or it can be varied in time as the note progresses. The mixer has its own dedicated envelope shaper to control the oscillator mix ratio. This capability is used to implement "waveform morphing", a technique used to vary the harmonic content of the sound with time. Waveform morphing can be used to realise a range of effects, beyond what is possible to achieve with filtering techniques.
The pitch of the secondary oscillator can be "detuned", i.e. increased or decreased relative to the primary oscillator. The "detune" factor is a patch parameter having units of "cents", so that the detune resolution is 1/100th of a semitone. If the detune factor is a fraction of a semitone, typically in the range 3 to 30 cents, and both oscillators are driven from wave-tables with similar harmonic content, the resulting effect is known as "Voix Celeste" (heavenly voice). This effect greatly enriches the soundscape possibilities of the synthesizer.
In addition to the two wave-table oscillators, a low-frequency oscillator (LFO) is provided. The LFO can be used to modulate the audio oscillator frequency to implement vibrato, or the LFO can be used to modulate the oscillator mix ratio. In the latter case, the mixer envelope output level determines the modulation depth.
An external analog filter of some sort is necessary to remove the 40kHz carrier frequency from the PWM audio output signal. The chosen filter is a 3rd-order low-pass circuit with a cut-off frequency of 10kHz and roll-off slope of -18dB per octave.
The amplitude (loudness) of the note-in-progress can be varied with time in a variety of ways depending on the instrument patch. A five-segment envelope shaper provides the classic "attack, peak-hold, decay, sustain, release" (AHDSR) amplitude profile. In addition to the envelope shaper, amplitude can be controlled by breath pressure or other MIDI IN Control Change messages.
The firmware includes several "pre-defined" synth patches providing a good variety of instrument sounds. Any pre-defined patch may be assigned to any of the 8 Presets via the user interface (GUI or CLI).
How the Synthesizer is Patched
The REMI synth can be programmed (patched) by the user to create a new sound, without needing to modify and re-compile the firmware. Instead of using knobs and switches like a "real" synthesizer, however, the REMI synth is patched by means of a set of numeric parameters... (see table below). A CLI command "patch" is provided for the purpose of setting patch parameter values. A user-created patch can be saved in non-volatile memory (EEPROM) for later recall. A stored "user patch" may also be assigned to any of the instrument Presets.
Table 1: REMI Synth Patch Parameters
Two patch parameters specify which wave-tables out of a large selection will be used by the synth oscillators. The assigned wave-tables determine the waveforms and hence the harmonic content of the oscillator outputs. A "user patch" can specify any pre-compiled wave-table (stored in MCU program memory).
The firmware also provides a utility for users to create their own wave-tables. A CLI command "wav" is provided for this purpose. A user-created wave-table can be tested in a user patch.
REMI makers who are prepared to re-compile the firmware can add their own patches and wave-tables, limited only by the amount of MCU flash program memory. CLI commands "patch" and "wav" include options to dump patch parameters and wave-table data (resp.) as C source code definitions.
Sample sound clips made with the REMI synthesizerNo post-processing effects were used in the recordings, except for a small amount of "concert hall" reverb to create a stereophonic image. More sample sound clips and a better quality demo video will be posted later!
There is enough information given here to allow experienced electronics hobbyists to replicate the REMI synth design. Detailed information such as step-by-step instructions, parts lists, etc, are not given in this post.
Compared with the earler (mk1) prototype, the new PIC32 synth module is greatly simplified. It is based on a PIC32-MX340 proto board from Olimex (pictured below), priced at €19.95 (US$22 approx). The board has parts added for the MIDI IN and MIDI OUT interface circuits, plus PWM audio output circuitry, 5V regulator for the MIDI interface and LCD panel, and an IIC EEPROM to store synth configuration and preset parameters.
separate prototyping board may be added to carry a headphone amplifier
with volume control.
The complete module incorporates a front-panel user interface (GUI) consisting of a low-cost monochrome graphic LCD panel and 6 push-buttons. The LCD module and key-switches are wired directly to I/O pads on the Olimex PIC32 board. This is the quickest and easiest wiring method. (See internal view below.)
A suitable LCD
panel is available from Sparkfun. Alternative modules
are available at low cost from online suppliers, e.g.
This type of LCD module is also available with smaller overall dimensions and a smaller
dot pitch (~0.4mm). There
are many variants of
the connector pinout, chip-select polarity, etc, so be sure
to observe the datasheet of the display module you choose. It's
probably best to use a module which has the signal names screen-printed
on the PCB connector pads.
If using a display with the ST7920 chip, the VDD supply voltage must be dropped to about 4.5V (via a Schottky diode) to ensure logic-level compatibility with the PIC32 I/O signals (3.3V outputs, 5V tolerant inputs on Port-E). A firmware variant can be compiled to support the ST7920 LCD controller chip.
The internal view above shows the LCD panel and push-button board wired to the PIC32 MCU board. Also shown are the MIDI sockets and volume control. The headphone amplifier had not been added when this photo was taken. A headphone amplifier will be mounted on the prototyping board (eventually).
Boards are mounted on plastic spacers or standoffs. The PIC32 MCU board and audio output board are mounted on the bottom panel of the box using 20mm x M3 machine screws (countersink heads). Standoffs for the LCD module and button board are glued to the inside of the lid (with 5-minute epoxy) so that screw heads are not visible on the outside.
The enclosure used for the prototype has plastic posts in each corner for the screws to hold the lid on. These posts prevented the PIC32 board from being mounted with the edge flush with the LH side of the box. The posts were cut (by drilling from the outside of the box) to allow the board to fit in place, allowing access to the "RS232" and DC power connectors. The 6-pin ICSP (programming) header was removed and replaced with a right-angle SIL-6 header, allowing access from the outside. The prototype was thus modified because of the many revisions that needed to be made to the firmware during development.
The REMI synth firmware includes a command-line user interface (CLI), accessible via the "RS-232" serial port provided on the PIC32 board. The CLI was originally intended mainly for firmware development, diagnostic and testing purposes, but the CLI now provides equivalent functions for all operations performed by the front-panel GUI -- and much more. You'll need a USB/Serial adapter cable (~ $10) and a PC terminal emulator application (e.g. 'PuTTY').
The LCD panel and keypad are optional. The REMI can be operated using just the console CLI. This is like the "Command Prompt" in Windows, or the "Console Terminal" in Linux. User interaction is all text-based. The REMI CLI has commands to do everything, e.g. test, set up configuration options, set up instrument Preset parameters, synth patch operations, wave-table selection and creation, etc.
In contrast, the front-panel GUI can perform only a subset of the CLI functions -- it's main purpose is to change the instrument 'Preset' parameters, for example to select the synthesizer "patch" (and/or MIDI voice for external synth) assigned to each Preset. It is convenient to be able to do this without the need to connect a computer.
The firmware supports most LCD modules using the KS0107/KS0108 controller chipset. This is the preferred option, because the KS0108 MCU interface is much faster than the ST7920. Moreover, the KS0108 MCU interface signals are compatible with 3.3V logic, which means that the LCD module can be powered directly from the 5V supply rail.Extra features implemented in version 2:
A PIC programming
tool, e.g. Microchip PICkit-3, is required to install the synth
REMI firmware is built using Microchip PIC development tools - MPLAB.X IDE with XC32 and XC8 compilers - free to download from Microchip's website. If you intend to modify or extend the firmware, you will need these tools. Otherwise, you just need to install the PIC programmer application (IPE) on your computer.
If you are interested in building a REMI synth module and/or EWI handset, or if you have enjoyed following the project here, kindly send me an email. Support is offerred to readers who wish to build a REMI or some other electronic music device. [MJB]
Last update: 17-DEC-2019