Create project Need help?
Show more (2)
M J Bauer

Recorder-like Electronic Musical Instrument and MIDI Controller

Status: Proposal
6989
21
votes
May 8, 2016 , Latest update: February 2, 2018
remi-complete-setup-w.jpg
Overview

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.

Another major design decision was that the REMI need not emulate the fingering scheme of a  traditional wind instrument such as the saxophone, clarinet, flute or recorder (although a few minor design changes would make this possible). These instruments have complicated fingering schemes, of necessity, due to the physical properties of air columns made to produce sound. In contrast, electronic sound-generating devices are not constrained by such physical properties. Hence, a simplified “binary” fingering scheme was devised for the generic REMI to minimise the number of combinations of finger positions required to produce all the notes on the chromatic scale. (See attached “Fingering Chart”.)

The instrument may consist of two main parts: a "handset" incorporating the touch-pads and other playing sensors and controls, plus a "controller module" housing a micro-processor, MIDI and audio circuitry and user interface components (LCD screen and keypad).

It was decided that the generic handset will have eight "keys" (touch-sensitive pads) on the upper playing surface, four of which are operated by the fingers on the right hand to select one of 13 notes in an octave (C-to-C), while three other "keys" are operated by fingers on the left hand to select one of seven octaves. One extra touch-pad operated by the 4th finger on the left hand may be assigned to a momentary effect such as vibrato.

Notes may be "triggered" (initiated) either by blowing into the mouth-piece (breath pressure sensor) or simply by changing the fingering pattern on the touch-pads. The latter option is called "touch trigger mode". The note trigger mode is a function of the instrument "preset" selection, which is user-configurable and maintained in non-volatile memory (EEPROM).

A “modulation lever” (linear slider pot) typically operated by the left-hand thumb can be assigned to control one of a number of patch parameters, for example “pitch bend” or filter corner frequency. In "touch trigger mode", however, the modulation lever would normally be used to vary the loudness of the note in progress.

A push-button switch on the underside of the handset, operated in conjunction with the RH touch-pads, selects one of several instrument "presets". The presets are chosen from a larger number of available instrument patches built into the micro-controller firmware, by means of a setup function in the user interface. The "presets" also select one of a group of MIDI "programs" (instruments) for use with an external MIDI sound module.

Another design objective was that the controller module should incorporate hardware and software capable of generating a variety of instrument sounds, 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 will be provided for direct audio output to an amplifier or headphones.

The controller module will provide 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.

The parts to build a REMI should cost much less than a commercial EWI.

REMI source code will be made freely available (for non-commercial purposes) allowing makers to tailor the firmware to suit their own design variants.

MIDI Controller

The MIDI OUT (transmit) command set includes: Program Selection, Note-On/Velocity, Note-Off, Channel After-touch (pressure), Pitch Bend (modulation), All Sound Off and System Reset. The REMI can be set up to use any one of the 16 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 octave touch pads is also pressed. After the first note is triggered, a Note-Off command will be sent for each note change (before sending a new Note-On) to release the note already sounding. Hence, the envelope shaper will be forced to "attack" for every note played. In this mode, the modulation lever typically controls the loudness of the note. The REMI will send "velocity" and "after-touch" data accordingly. Depending on the selected preset, legato mode may be enabled by the “effect” touch-pad, if the external sound module supports this mode.

Every time a new note is triggered, the position of the modulation lever (linear slider pot) is "re-calibrated" (set to zero), assuming the lever is assigned to the pitch bend function, so that the pitch of the note will be "in tune" as long as the lever position stays put. This scheme avoids the need to construct a complicated “spring-return-to-centre-position” mechanism.

If the PRESET button is pressed while none of the touch-pads is touched, the REMI will transmit an "All Sound Off" command followed by a "System Reset" command. This operation also "zeroes" the modulation lever. Otherwise, if the PRESET button is pressed in conjunction with one or more RH touch-pads, a "Program Change" command will be transmitted. The Program Number sent depends on the user-defined "Preset Configuration".

Built-In Sound Synthesizer

It is intended that the REMI's built-in sound synth will be implemented largely in firmware, requiring minimal additional electronic circuitry ‒ just a PWM-controlled filter and PWM-controlled signal attenuator in the audio output circuit. To generate audio tones, REMI will use a "wave-table oscillator" offering a selection of arbitrary waveforms which can range from very simple to quite complex. A PIC32MX processor clocked at 80MHz makes possible a sampling rate of 20kHz with 12-bit sample values.

The basic synth model includes, in addition to the wave-table oscillator, a low-frequency oscillator (LFO) used to modulate pitch (for a vibrato effect), a noise generator with variable output mixed with the oscillator output, plus an analog filter with a roll-off slope of −12dB per octave. The filter can be switched to low-pass or band-pass mode. The corner/centre 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 oscillator, or it can be set to a fixed frequency. The filter has a dedicated envelope shaper allowing the timbre (harmonic content) of the sound to be varied in time as the note progresses.

The amplitude (loudness) of the note-in-progress can be varied with time in a variety of ways depending on the instrument patch and note trigger mode. A five-segment envelope shaper provides an "attack, peak, decay, sustain, release" (APDSR) amplitude profile. In addition to the envelope shaper, amplitude can be controlled by the breath pressure sensor signal, or by the "modulation lever" signal, depending on the selected patch.

Controller Module Design & Construction

The author's first 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/patch configuration (built-in sounds), master volume control, MIDI controller setup (channel and preset/program 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 is intended mainly for firmware development, diagnostic and testing purposes, but may also provide some esoteric "end-user" facilities.

A more refined "beta" prototype MCU module will use a PIC32MX340 micro-controller, which has much the same spec's as the 'MX460 except that the 'MX340 has no USB peripheral. The basic REMI model doesn't need USB mass storage and there is no immediate plan to implement intrinsic USB-MIDI device capability.

If the REMI project proves to be popular and there is sufficient demand, a set of custom-designed PCB's may be made available to simplify construction. Meanwhile, intrepid REMI makers are recommended to use the PIC32-MX340 proto board from Olimex. This board has a generous prototyping area, so it should be possible to fit onto it all of the components needed for the basic REMI controller. A 5V DC supply rail is required, but the MX340 board doesn’t have a 5V regulator. The recommended solution is to modify the board so that it is powered from a plug-pack PSU with regulated 5V DC output. 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 Controller Module schematic (downloadable via a link on this post) is intended for construction based on the Olimex PIC32-MX340 prototyping board. Pictures of a completed  MX340 prototype board will be available in a future post. Meanwhile, pictures of the “alpha” prototype controller module (based on the Olimex PIC32-MX460 board) will give prospective makers a feel for the amount of board space, the number of parts required and the wiring complexity of the add-on circuitry.

There is an option (shown on the schematic) to omit parts of the audio circuitry to reduce the construction effort. The reduced version removes the band-pass mode from the PWM-controlled filter. Experimenting with the built-in sound synthesizer will reveal whether or not it may be worth the extra effort to include the band-pass filter option. The audio circuitry may be omitted altogether if the built-in sound synthesizer is not wanted, of course.

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.

Detailed circuit descriptions and a comprehensive parts list will be made available in a future post, if there is encouraging reader interest in the project. (Post your comments!)

Handset Design & Construction

The generic REMI handset comprises 8 touch-pads, an air-pressure sensor (Freescale MPXV4006-GP), a linear slide potentiometer for the modulation lever (e.g. Bourns PTA3043-2010CIB103) plus a push-button switch for PRESET selection, etc. The touch-pads are wired to a Freescale MPR121 capacitive touch sensor IC breakout board available from SparkFun, interfaced to the MCU via an I2C serial bus. The handset is connected to the MCU module via a 6-wire cable (including +5V DC power, 2-wire I2C bus and 2 analog sensor signals).

A glance at the MPR121 data-sheet reveals that this device is truly awesome! Not only does it reliably detect binary (on/off) touch states of the connected pads, but it can also report analog readings of the capacitance on the pads, giving a measurement of the touch pressure applied. This capability could be exploited to implement enhanced expressiveness in playing, outputting additional MIDI “after-touch” channel control data to the external sound module. Alternatively, analog touch readings could be used to implement “half-hole keying” as required to emulate some traditional wind instruments, notably the recorder. Future design enhancements of the REMI could provide such features.

The simplest way to make the touch-pads is to use small machine screws (round-head, flat-head, countersink, according to personal preference) inserted into the handset playing surface (an insulating material, e.g. plastic or wood), with solder lugs for wiring to the MPR121.

Alternatively, touch-pads may be formed into a piece of blank PCB laminate, mechanically etched by hand using a Dremel-style power-tool with a small burr, about 1.5mm. The author’s  prototype handset (pictured) was made using this method. The enclosure was made out of a gutted AC power-board, with the unwanted holes filled with "Plasti-Bond" (2-part epoxy resin). This seemed like a good idea at the time, but took more time and effort than anticipated. With the benefit of hindsight, I don’t recommend this idea. Also, the positioning of pads on the prototype handset is not quite optimal.

Details of simpler methods of construction of the handset, plus a drill template/drawing for locating holes for the touch-pads, will be given in a later post.

The layout of touch-pads and controls can be varied to suit your chosen enclosure style, as long as playability is retained, of course. For example, the “upper” (left hand) and “lower” (right hand) touch pads don’t need to be located in-line as in a traditional wind instrument. Instead, the left and right hand touch-pads could be placed on opposite sides to suit housing in a small rectangular box, which would need to be sized at least 140 x 70 x 25 mm. Such an enclosure style would be more suited to an instrument intended for playing using only the “touch-trigger mode”, i.e. without the breath pressure sensor. A different type of sensor could be substituted to provide MIDI “Note-On Velocity” and “Channel After-Touch” signals. It could be worthwhile experimenting with a Hall-effect proximity sensor (e.g. Allegro A1301-2) or a resistive force transducer (FSR).

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 handset (pictured) used nylon tubing (3mm ID, 5.5mm OD) for the internal airways linking the mouth-piece, pressure sensor IC and the “moisture drain tube”. The mouth-piece was formed out of 12mm black irrigation tubing, using a hot-air blower. (There were a few rejects!)

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

Firmware

At the time of posting this introductory article, REMI firmware was incomplete and therefore not ready for release. However, development is now sufficiently progressed to verify that the essential design objectives can be realised. Firmware, including source code, will be released with a future update post, when a properly functional build is developed. Meanwhile, enthusiastic makers with appropriate prototyping skills can begin constructing the hardware.

A PIC programming tool, e.g. Microchip PICkit-2 or PICkit-3, or functional equivalent, will be required to install the REMI application firmware, initially.

At a later stage in the evolution of the firmware, it is planned to incorporate a boot-loader which will allow updating of the application firmware without a programming tool. The boot-loader will program the MCU flash memory from a hex object file stored on your PC hard-drive, via a serial data link (using a low-cost USB/serial adapter cable). Of course, the (one-time) installation of the boot-loader will require a programming tool.

To be continued!
___________________________________________________________________________

Links

REMI project website (with pictures)
Olimex PIC32MX340 prototyping board
SparkFun MPR121 breakout board



 
Read the full post
Show less
Images
REMI Alpha prototype internal view
Alpha prototype I/O Extension board pics
Olimex PIC32-MX340 Prototyping Board
REMI handset front-top-side view
REMI Controller Module (mk1) - with LCD screen and keypad
REMI Synth Tone Generator Model (Simplified)
Schematics
Other

Loading comments...