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. However, it was decided that the REMI should also be playable just by changing finger positions on the “keys” (touch-pads), without blowing. Played in this mode, the instrument allows the player to sing along.
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. A socket is provided for audio line output to an amplifier 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.
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. 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 semitome, 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 to modulate pitch, for Pitch Bend and/or Vibrato capability. The mixer has its own dedicated envelope shaper to control the oscillator mix ratio, to implement the aforementioned "waveform morphing" feature.
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 (LUI 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.
... to be continued ...
(Sample sound clips will be posted soon!)
The original REMI article proposed a unique “binary” fingering scheme designed to minimise the number of “keys” (touch-pads), hence finger combinations, required to select notes on the chromatic scale. Some readers have commented that this scheme may be “counter-intuitive” and therefore might defeat the objective of being “easy to learn to play”. Moreover, I acknowledge that the “binary” keying scheme is unlikely to appeal to players of traditional wind instruments.
In response to these concerns, I have devised an alternative fingering scheme based on a traditional wind instrument, i.e. the descant recorder, albeit with some (justifiable) simplifications. This 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. This requirement allows the “Touch Trigger Mode” to be implemented.
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, up to G". Above G", there is a discontinuity in fingering pattern, of necessity, but it keeps to a consistent progression, unlike the recorder which becomes inconsistent beyond the first octave.
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
The author's prototype REMI controller module (pictured) was built around a PIC32-MX460 development board made by Olimex plus an I/O extension board implementing the handset interface, MIDI output driver and audio signal processing circuitry. The MCU module also incorporates a "local user interface" (LUI) consisting of a low-cost monochrome LCD screen and 16-button keypad. The LUI provides facilities for instrument preset and patch configuration, MIDI controller setup (channel and program/voice selection) and so on.
The firmware also 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 provides equivalent functions for all operations performed by the local UI -- and more.
The recommended board for making the REMI controller module is a PIC32-MX340 proto board from Olimex, priced at €19.95 (US$22 approx). This board has a PIC32MX340 micro-controller, which has much the same spec's as the 'MX460 except that the 'MX340 has no USB peripheral. If needed, MIDI-USB device capability can be achieved easily using a low-cost MIDI-USB adapter/cable.
The LCD module chosen for the prototype uses an ST7920 display controller chip with a monochrome back-lit graphical LCD screen of 128 x 64 pixels. Equivalent types are readily available at low cost from online suppliers, e.g. Ali-Express. Be aware that LCD manufacturers make design variations in, for example, 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 data-sheet.
A 16-button numeric keypad (wired in a 4x4 matrix) is 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. The 4-wire keypad interface requires six resistors to be wired between the external keypad terminals, as shown in the diagram.
Currently under development is an alternative controller module which simplifies construction by omitting non-essential parts, for example the high-pass filter, LCD screen and keypad. All components will fit on the Olimex PIC32MX proto board. This is called the "REMI Minor" build variant. All setup operations can be done using the command-line user interface. (See REMI version 2 preview.)
The fully-optioned build of the REMI including LCD screen, keypad and audio high-pass filter, is called the "REMI Major" variant. There is not enough space on the PIC32MX340 proto board to fit all components and connectors needed. However, the audio circuitry can be built on 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.
The "Bauer EWI" 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).
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, sealed in place with Silicone sealant compound. 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. The linear slider pot used in the original handset was found to be less than ideal. There was too much friction, making it difficult to move the lever quickly. A different type of sensor could be substituted to make the Modulation Lever. It could be worthwhile experimenting with a Hall-effect proximity sensor (e.g. Allegro A1301-2) or a resistive force transducer (FSR). Other home-brew EWI designs I have seen on the web use low-profile joystick mechanisms, as found in hand-held game controllers.
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. More details here.
DIY Modulation Lever (Rocker)
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).
The current firmware release is v0.9.
MIDI controller implementation is complete and fully operational.
The built-in sound synthesizer is fully operational and almost complete, with newly added instrument patches and wave-table definitions. With an audio sample rate of 40kHz, and dynamic range of 66dB, the sound quality has exceeded my original expectations. Further enhancements to the REMI synth are planned.
This firmware release (v0.9.00) includes changes and additions outlined below...
Planned to be implemented in future revisions:
The front-panel UI was designed to be "highly intuitive", so it shouldn't need a manual. A user guide for the console CLI will be forthcoming if there is sufficient interest shown in the project. Meanwhile, there is "help" available for most commands by typing the command name followed by a question mark, e.g. "patch ?". Comments in the source code may provide more detailed information.
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.
If you are already familiar with another embedded IDE (integrated development environment), e.g. Atmel AVR Studio, you will find MPLAB.X IDE just as easy (or difficult) to use.
Last revised: 19-APR-2017