Build the "REMI"
A DIY Project by M.J. Bauer
The concept for the "REMI" came from a desire to create a simple but practical musical instrument which is easy to learn to play. An early design decision was to model the REMI loosely after existing “electronic wind instruments” (EWI's) using touch-sensitive pads for the “keys” to select the pitch of notes. A breath pressure sensor allows notes to be articulated by blowing into a mouth-piece.
The instrument consists of two main parts: a "handset" incorporating the touch-pads and other playing sensors and controls, plus a "controller module" housing a PIC32 micro-controller, MIDI and audio circuitry and (optionally) a front-panel user interface comprising an LCD screen and 16-button keypad.
The controller module incorporates a built-in sound synthesizer, so that the REMI can be used "stand-alone", i.e. without needing to be plugged into an external MIDI synthesizer or computer. Sockets are provided for audio output to an amplifier and/or headphones.
The controller module provides a MIDI output (5-pin DIN socket) for direct connection to a MIDI synthesizer or sound module, or to a personal computer via a MIDI/USB adapter.
A “modulation lever” operated by the thumb may be assigned to control one of a number of sound parameters, for example “pitch bend”, vibrato depth, noise level or filter corner frequency. If not assigned to "pitch bend", the modulation lever can be configured as a MIDI controller to send periodic MIDI Control Change messages.
A push-button switch on the under-side of the handset, operated in conjunction with the RH touch-pads, selects one of several instrument "Presets". The selected Preset determines various instrument and MIDI configuration parameters. For example, a Preset sound is chosen from a collection of pre-defined synth patches built into the micro-controller firmware. The Preset also selects one of a group of MIDI "programs" (instrument voices) for use with an external MIDI sound module.
The cost of parts to build a REMI is much less than a commercial EWI.
REMI source code is freely available, allowing makers to tailor the firmware to suit their own design variants, or to add as many synth patches and wave-tables as will fit into the MCU flash memory.
The MIDI OUT (transmit) command set includes: Program (voice) selection, Note-On/Velocity, Note-Off, Channel After-touch (pressure), Expression or Channel Volume, Pitch Bend, Control Change (effect modulation), All Sound Off and System Reset. The REMI can be set up to use any one of the 16 basic MIDI channels.
In normal note trigger mode, the REMI will send a Note-On/Velocity command when the breath pressure exceeds a preset threshold. A corresponding Note-Off command will be sent when the breath pressure drops below the "note-off pressure level". After a new note is initiated, a change in fingering pattern will cause another Note-On/Velocity command to be transmitted without first sending a Note-Off. If the external MIDI sound module is set to Mono mode, this should cause the module to produce a different note, i.e. to change pitch, without "re-attacking" the amplitude envelope. The musical term for this is "Legato".
In "touch trigger mode", a new note will be initiated whenever the fingering pattern changes, as long as (or when) one or more of the LH touch pads and at least one of the octave touch pads is also pressed. Otherwise, the "Legato" effect will be applied, as in normal trigger mode. The Modulation Lever can be configured to control the loudness of the note, i.e. to determine MIDI "Expression" values.
While none of the octave touch-pads and none of the upper 3 (LH) pads is pressed, the PRESET button may be pressed in conjunction with one or more RH touch-pads to select one of a number of instrument "Presets". A MIDI "Program Change" command will be transmitted. The Program Number sent depends on the user-defined Preset configuration.
While a note is being played, the PRESET button can function as an "effect switch". The controlled effect is dependent on the external synth or MIDI sound module, for example to turn vibrato on and off. In addition, the PRESET button has a special function while none of the touch-pads is touched. In this case, pressing the PRESET button will cause the REMI to transmit a MIDI "All Sound Off" command followed by a "System Reset" command.
REMI's built-in sound synth is implemented largely in software, requiring minimal electronic circuitry outside of the MCU chip -- just a low-pass filter and PWM-controlled signal attenuator in the audio output circuit. To generate audio tones, REMI uses a "wave-table oscillator" algorithm offering a variety of waveforms which can range from simple to rich and complex sounds, some resembling acoustic instruments.
A PIC32MX processor clocked at 80MHz makes possible a sample rate of 40 kHz with 11-bit sample values, resulting in high-quality audio. Output level is determined by a PWM-controlled attenuator with 11-bit resolution, giving a dynamic range of 1:2000 (66 dB). Not quite CD quality, but comparable to MP3 at a high bit-rate.
For clarity, the diagram omits the LFO, envelope shapers and PWM-controlled audio attenuator.
The synth model comprises a pair of wave-table oscillators which can 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 recommended filter is a 2-pole low-pass circuit with a roll-off slope of -12dB per octave. The corner frequency is variable over a three decade range (10Hz ~ 10kHz) by means of a PWM signal generated by the MCU. The filter can be made to track the pitch of the primary oscillator, or it can be set to a fixed frequency. A simpler 2-pole fixed-frequency (10kHz) low-pass filter may be substituted if desired to reduce construction effort, with very little sacrifice of the synth capabilities.
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 the breath pressure sensor, or by the modulation lever, or by 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 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. The 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. The "user patch" can specify any pre-compiled wave-table (stored in MCU program memory) or it can specify a "user wavetable" which, as the name suggests, may be created by the user. A CLI command "wav" is provided for this purpose. The "user wavetable" is also stored in non-volatile memory for later recall.
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. Please excuse my poor musicianship... I'm still learning to play. When the REMI firmware supports MIDI IN messages, I'll use a sequencer to create better clips.
More sample sound clips will be posted soon!
REMI fingering is based on a traditional wind instrument, the descant recorder, with simplifications. The scheme uses eight touch-pads on the upper surface, i.e. one pad (hole) fewer than the recorder. Three pads are operated by fingers on the left hand while five pads are operated by fingers on the right hand. The 4th and 5th RH pads are both operated by the 4th finger.
Two pads on the underside of the handset, operated by the left-hand thumb, select one of three octave ranges. The octave pads are constructed so that both can be activated together by the thumb. At least one octave pad, and at least one of the 3 upper (left-hand) pads, must be activated for a note to sound.
Referring to the “Bauer EWI Fingering Chart” below, it can be seen that the fingering combinations cover two octaves, without changing the octave selection by the LH thumb. The octave pads extend the overall range to four octaves. Selection of notes in the first octave follows quite closely the fingering patterns of the recorder, including C (Alt.) above the lowest C. Contrary to the recorder, however, the second octave simply repeats the fingering pattern of the first octave, but with the top pad (LH1) released, right up to G".
Although there are many more finger combinations with 8 touch-pads than there are semitones covering the two octaves, every finger combination produces a note pitched on the chromatic scale. The redundant finger combinations are designed to be musically intuitive.
Two octave pads are positioned on the underside of the handset, such that one or other or both pads together may be selected by the left thumb. The octave pads extend the range of available notes to four octaves, for example C3 to C7.
If two or more pads marked with a diamond symbol (◊) are touched, the effect is the same as if any one of the pads is touched, i.e. the note is flattened by one semitone.
The 4th finger on the right hand can select either pad RH4 or RH5, which are close together.
Pads RH4 and RH5 should be located so that both can be touched at once by the 4th finger, but this fingering oddity is needed only for selection of the alternate B note in each octave.The alternate C" is designed to maintain semblance to recorder fingering in the first octave.
Controller Module Design & Construction (prototype)
If you can't wait until such time as a PCB becomes available, bare board or fully assembled, various options exist to construct a REMI controller module, if you have good prototyping skills. The recommended micro-controller board for the contoller module is the PIC32-MX340 proto board from Olimex, priced at €19.95 (US$22 approx).
The fully-optioned build includes front-panel user-interface (LCD screen and keypad), classic MIDI IN and MIDI OUT connectors (5-pin DIN) and built-in synth audio circuitry. There is not enough space on the PIC32MX340 proto board to fit all components and connectors needed. The audio circuitry is built onto a separate prototyping board, requiring only 7 wires to connect to the main board. All other components and connectors will fit easily on the main board. (See REMI controller schematics - 2 sheets.)
If needed, MIDI-USB device capability can be achieved easily using a low-cost MIDI-USB adapter/cable.
The author's prototype REMI controller module (rev.A) was built around a PIC32-MX460 development board, also made by Olimex, plus an extension board implementing the handset interface, MIDI output driver and audio signal processing circuitry. The module incorporates a front-panel user interface consisting of a low-cost monochrome graphic LCD screen and 16-button keypad. The front panel UI provides facilities for instrument preset and patch selection, MIDI controller setup (channel and program/voice selection) and so on.
The firmware includes a command-line user interface (CLI), accessible via the "RS-232" serial port provided on the MCU 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 UI -- 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, etc. In contrast, the front-panel UI can do only a subset of these tasks - 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 PC terminal.
The LCD module chosen for the REMI prototype used an ST7920 display controller chip with a monochrome back-lit graphic LCD screen of 128 x 64 pixels.
Note: It is planned to support LCD modules using the KS0107/KS0108 controller chipset. This is the preferred option, because the KS0107/08 MCU interface is much faster than the ST7920.
A suitable LCD panel is available from Sparkfun. Equivalent modules are available at low cost from online suppliers, e.g. Ali-Express. Beware that LCD manufacturers make design variations in supply voltage (3.3V or 5V), connector pin-outs and external wiring requirements. A contrast adjust trim-pot may or may not be needed. Follow the application example for 8-bit parallel bus operation in the LCD module data-sheet.
A 16-button numeric keypad (wired in a 4x4 matrix) can be interfaced to the micro-controller using only four wires. This scheme works by using ADC voltage readings to determine the row and column addresses of a key when pressed, in similar manner to reading a resistive touch-screen.
Note: It is planned to implement a front-panel UI with a set of 6 push-buttons instead of the 4x4 keypad, because numeric data entry is not required.
A 5V DC supply rail is required, but the Olimex 'MX340 board doesn’t have a 5V regulator... only 3.3V. The recommended solution is to modify the board so that it is powered from a plug-pack PSU with regulated 5V DC output. These are readily available for charging battery-powered devices via a USB cable. Carefully remove the bridge rectifier (G2) and, in its place, solder a Schottky diode (1N5819) from the DC input jack centre-pin contact to the input of the LM1117 3.3V LDO regulator (VR1). Solder a wire link from the DC jack outer ring contact to GND. Fit a compatible plug to the cable on the PSU.
The REMI handset comprises 10 touch-pads, an air-pressure sensor (Freescale MPXV4006-GP), plus a push-button switch for PRESET selection, etc. The touch-pads are wired to a Freescale MPR121 capacitive touch sensor IC breakout board from SparkFun, interfaced to the MCU via an I2C serial bus. The handset is connected to the MCU via a 6-wire cable (including +5V DC power, 2-wire I2C bus and 2 analog sensor signals).
A planned design revision is to provide a wireless RF link between the handset and controller module. The handset will be battery powered, giving the player complete freedom of movement during performance.
The prototype handset was made from two pieces of PVC plastic cut from a scrap of drain pipe, 110mm outside diameter, 3mm wall thickness. A suitable scrap may be found perhaps on a building site. The curved surface makes the plastic covers very rigid and strong. The upper piece has 3 wooden "ribs" (8~12mm thick) glued to it, allowing the bottom cover to be attached with self-tapping screws. Side strips of fibre laminate or timber veneer may be glued to the ribs. The plastic surfaces were not painted, but rubbed with fine abrasive cloth (P400) to give a smooth matte finish. The result is a very "retro" (1950's) look and feel. For a more modern look, the plastic covers may be spray-painted and the side strips made from brushed aluminium.
The touch-pads are self-tapping screws with a broad flat head, cadmium-plated (I think). These are inserted through holes in the handset playing surface, fastened on the inside with aluminium retainers (~9mm square). Machine screws with hex nuts would be better if you can find a variety with a broad flat head, plated with a corrosion-resistant metal. Solder lugs are fitted under the retainers (nuts) for wiring to the MPR121 board. A drill template and cross-section drawing are available for download -- see links at bottom of page.
The mouth-piece is carved out of soft-wood with a 6mm hole drilled through the middle. It should be coated with a water-based sealer* to prevent moisture absorption in the wood. The nylon tubing is inserted into the 6mm hole, all the way through to the tip, and held in place with a water-based sealer. The mouth-piece is attached to the upper plastic cover with 4 self-tappers, so that it is easily removeable.
*Warning: Do not use a paint or laquer with oil-based solvent on the mouthpiece, for 3 reasons... (1) it tastes terrible, (2) it could cause a health hazard, and (3) the vapours given off by the solvent could damage the Fluoro-silicone membrane in the pressure sensor. Recommended coatings for the mouthpiece are water-based polyurethane, PVA wood-working glue (dries clear), or some other safe product used to paint wooden toys.
Pitch-Bend / Modulation Lever
A Modulation Lever mechanism may be fitted on the handset, located so that it can be operated by the right-hand thumb, or it may be omitted altogether. Makers with adequate workshop skills and plenty of spare time may opt for a DIY solution to build a suitable lever mechanism. The technique I decided on was to use an optical position sensor. A shutter or vane moving between a LED and a photo-cell gives a variable output voltage. Details here
It is planned to design a Mod Lever or some other control mechanism with simpler construction.
Pressure Sensor “plumbing”
Tubing and other bits and pieces needed to make the airways inside the handset may be sourced from the garden irrigation section of your local hardware store. The prototype handsets (pictured) used clear nylon tubing (3mm ID, approx 5.5mm OD) for the internal airways linking the mouth-piece, pressure sensor IC and the "drain tube”. The T-joiner needed the barbs cut off to fit the 3mm tubing.
It is not essential to make a special mouth-piece. For simplicity, it suffices to blow directly into a length of nylon tubing extending out of the top end of the handset. It is left to the maker's ingenuity to devise a more stylish mouth-piece arrangement, if desired.
The sensor air inlet barb is slightly less than 3mm in diameter, which is a wee bit too small to make a good seal with the 3mm ID nylon tube. An easy solution is to fit a short bit of 2.5mm (nominal diameter) heat-shrink tubing over the barb, shrink it with a hot air blower or whatever (taking care not to melt the sensor!), then fit the 3mm nylon tube over it.
A drain tube is
recommended because moisture condensation occurs inside
the airways and it is probably sensible to provide an
exit for the moisture rather than let it accumulate. Also,
the drain tube allows air-flow, which is preferable to a
sealed system for playability. However, the exit air flow
needs to be restricted somewhat to produce a sufficient
range of pressure inside the sensor. This can be achieved
by fitting into the end of the drain-tube a small plug
with a 2mm hole through it, perhaps cut from a bit of
plastic insulation sleeving if you can find some of
suitable size (3mm OD, 2mm ID).
current firmware release is v1.0.
A PIC programming
tool, e.g. Microchip PICkit-3, is required to install the REMI application
REMI firmware is built using Microchip PIC development tools - MPLAB.X IDE with XC32 compiler - 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. The IPE comes with MPLAB.X.
A comprehensive user guide will be produced. Meanwhile, there is "help" available for each CLI command by typing the command name followed by a question mark, e.g. "config ?". Comments in the source code may provide more detailed information. The front-panel GUI was designed to be "highly intuitive", so it shouldn't need a manual.
* News Update *
I am thrilled to announce that Elektor has expressed keen interest in further development of the REMI for publication as a DIY construction project in their magazine.
Another electronics design engineer who has had many articles published in Elektor magazine will be collaborating with me to complete development of the REMI, which will have a wireless handset!
This means that commercial-quality circuit boards (bare PCB or fully-assembled), and perhaps a 3D-printed enclosure for the handset, will be available to buy online from the Elektor shop.
Last revised: 02-JUN-2017