Build the "REMI Synth" (mk2)
Monophonic MIDI Sound Synthesizer designed for EWI's

A DIY Project by M.J. Bauer

This post describes the design of the "second generation" (mk2) REMI synth module.
For a general introduction to the project, see the page: "Introduction to the REMI".

Synth mk2
REMI 'mk2' Synth Module prototype

Overview

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. 

Features

  • High quality audio output: >60dB dynamic range, 40kHz sample rate, 32-bit precision DSP
  • High accuracy oscillator pitch for musical application
  • Dual wave-table sound synthesis with mix-ratio modulation (morphing)
  • Classic MIDI-IN and MIDI-OUT connections (DIN-5/180)
  • Graphical user interface (2.5" monochrome LCD, 128x64 pixels)
  • Command-line interface (CLI) for setup and patching (using PC via USB-serial adapter)
  • Instrument presets (8) selectable from REMI handset or other MIDI input source
  • Audio line output to external amplifier (RCA phono skt)
  • Internal headhone amplifier with volume control (3.5mm jack)
  • The 'MIDI IN' socket supplies 5V DC to the REMI handset using 2 spare pins
  • User-programmable synth patches and wave-table creator (via CLI on PC terminal)
  • Audio DSP software library (C source code) for user development
  • Optional wireless communications using RF module
RH side panel
Right-hand side connector panel

Synthesizer Design

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.

remi synth model (simplified)

For clarity, the diagram omits the LFO, noise generator, envelope shapers and output attenuator.
(NB: This model is somewhat obsolete. A revised patch model is currently in development.)

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

Oscillators Mixer & Contour Env. Noise Mix & Filter Envelope & Ampld Ctrl
OSC1 Wave-Table  Mixer Control Mode Noise Filter Mode
Amplitude Env Attack
OSC2 Wave-Table  Mixer OSC2 Level (%) Noise Level Control Mode Amplitude Env Peak Time
OSC2 Detune (cents)
Contour Env Start Level (%) Filter Freq. Control Mode Amplitude Env Decay Time
Pitch Bend Range (cents) Contour Env Delay Time Filter Corner Frequency Amplitude Env Sustain Level
LFO Frequency Contour Env Ramp Time Filter Resonance Amplitude Env Release Time
Vibrato Depth (cents) Contour Env Hold Level (%) Filter Pitch Tracking (offset) Output Ampld Control Mode
Vibrato Delay/Ramp Time

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.

Details of REMI synth functionality and operation using the console CLI and (optional) front-panel GUI are provided in the Synth User Guide.

Sample sound clips made with the REMI synthesizer

No post-processing effects were used in the recordings, except for a small amount of "concert hall" reverb to create a stereophonic image. Please excuse my poor musicianship -- I'm just a beginner! More sample sound clips and a better quality demo video will be posted later. (I'll use a MIDI sequencer.)

Play Sound ClipRecorder (plain) Play Sound ClipRecorder with Celeste
Play Sound ClipOboe -- Hard Reed Play Sound ClipJazz Organ with Celeste

REMI demo video


Construction

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

Note: A fully-assembled circuit board (or bare PCB) may be available in the near future!

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, plus an IIC EEPROM to store synth configuration and preset parameters.
A separate prototyping board may be added to carry a headphone amplifier with volume control.

View synth schematic diagram
Erratum: The schematic shows EEPROM type 24LC64, but the current firmware supports type 24LC08B only.
The device pinouts are identical. Future firmware revisions may support both types.

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

NB: Provision of a front-panel (LCD module and push-buttons) is optional. The REMI synth can be operated completely with the CLI alone. The firmware adapts itself automatically if the front-panel is absent.

PIC32 synth proto
Olimex PIC32MX prototype board with REMI add-ons (before wiring the LCD panel)

A suitable LCD panel is available from Sparkfun. Alternative modules are available at low cost from online suppliers, e.g. Ali-Express. 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.

Internal view - lid off

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. A pre-built headphone amplifier (breakout board with TPA6112 IC) was fitted on the prototyping board later, as shown in the photo below.

Synth headphone amp board

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 ongoing revisions that need to be made to the firmware during development.

LH side view

Left side panel showing modified ICSP header protruding thru a cut-out


Firmware

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

Provision of an LCD panel and keypad is optional. The synth 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. set up configuration options, set up instrument Preset parameters, synth patch programming operations, wave-table creation, sound testing, 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.

New features added in firmware update v2.3.xx:
  • Noise Generator and Noise Filter (for "pitched noise" effects)
  • Effect modulation by breath pressure (CC2) and/or modulation messages (CC1)
  • DSP Filter with variable cutoff frequency and resonance, pitch tracking
  • Filter frequency control by Expression (CC2), Ampld Env, Mod'n (CC1) or LFO
  • Reverberation effect

Programming Tool

A PIC programming tool, e.g. Microchip PICkit-3, is required to install the synth application firmware.
Low-cost PICkit-3 clones are available from online suppliers via AliExpress, eBay, etc.

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.

Note: A firmware revision is planned to include a bootloader which will allow the synth firmware to be updated via the CLI serial port (using a USB/serial adapter-cable).
___


User Guide  *** New in 2021 ***

Details of REMI synth functionality and operation using the CLI and (optional) front-panel GUI are provided in the Synth User Guide. (This is a work-in-progress which will be updated from time to time.)


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]

link to email address

Last update: 19-JAN-2021

MJB Resources for Embedded Firmware Development

___