Some small projects are interesting because they can enable more than their initial proposition, and the simplicity of producing synthesized sounds using a MIDI interface allows us to experiment with different types of instrument ‘user interfaces’.
In this project I build a flexible software kernel for a DIY MIDI percussion kit that can initially be used with switches and piezo sensors but is easily extensible.
Playing MIDI percussion
MIDI percussion instruments are defined in the General MIDI (GM) specification. GM is a standardized specification for electronic musical instruments that respond to MIDI messages.
To be GM compatible, synthesizers must obey the conventions for program and controller events. Importantly for this project, in GM compatible files, MIDI channel 10 is reserved for percussion instruments only.
The way this works is that events recorded on channel 10 always produce percussion sounds when transmitted to a keyboard or synth module. Each of the different possible notes correlate to a unique percussive instrument – the note number no longer relates to the sound’s pitch but specifies the instrument type. The GM percussive instruments are shown below, mapped to a the notes normally generated by a keyboard.
This means that playing a MIDI percussion instrument is the same as initiating a MIDI note on event appropriate for the instrument on MIDI channel 10. Percussion instruments also do not strictly need a explicit note off event to follow as for a normal note being played.
Prior to starting the project, the first design decision decision is which sensor(s) should be used to detect ‘hits’ to the percussion instruments.
A switch is good to detect the digital on/off signals for a simple hit, and this will suit many, if not all, percussion instruments. But what if we want some force feedback from the sensor so that the ‘hit’ can incorporate some level of musical expression (eg, MIDI otuput volume)?
A good choice for this type of feedback is a piezoelectric sensor – a device that uses piezoelectric material that generates a voltage when it is compressed. The piezoelectric effect is used to measure changes in pressure, acceleration, temperature, strain, or force by converting them to an electrical charge. These sensors are easily sourced and very inexpensive. The most common are shaped as thin circular disks shown at left.
When an impulsive force (eg, a drumstick strike) is applied to the sensor it responds with a brief voltage spike. The voltage output is proportional to the force applied.
An example spike is captured in the oscilloscope trace below. In this case the bare sensor is struck directly – the voltage spike is close to 60V and lasts about half a millisecond (500 microseconds). The output also has a negative voltage component – about 5V in this case.
5V Arduino inputs (at least for AVR processors) will not tolerate 60V, nor will they tolerate more than about -0.5V, so the raw signal must be conditioned. The length of the signal could also be too short to be reliably detected by the Arduino code.
One way to do this is using the simple circuit below. The 1MΩ resistor is connected in parallel to the piezo element to limit current (and voltage) produced by the piezoelectric element, while the zener diode ensures that the output voltage is effectively clamped to 5V.
Making a ‘drum’ style device
To turn the piezo into a drum type instrument, the sensor element needs to be incorporated into something that provides a bigger and bulkier striking surface that allows the musician to play using sticks or their fingers.
As a start, the piezo sensor should be bonded to a larger mass. In this setup, I epoxied the sensor disc to the center of a steel plate 2-3mm thick cut from an old computer case. The central position is used as this is the place where there is a maximum deflection in the plate.
Using the steel plate protects the sensor from direct strikes (they can be fragile) and the additional ‘echo’ vibrations of the plate should extend the signal generated.
A bare steel plate would produce a pinging noise of its own when struck, so it is layered between a dense foam top surface and a foam cushion below. Together they effectively dull the sound of the steel being hit while still allowing reverberations in the steel plate. The figure below shows the different layers in cross section.
The final arrangement for the device is shown below. The lower part of the photo shows the separated parts, as described above, and the top hexagon is an assembled unit. Note the bonded piezo sensor is covered in electrical tape to prevent short circuits. The zener diode and resistor are mounted to the plate (shown below with tape covering temporarily removed for the photo).
Once the sensor is mounted in the arrangement shown , it has a new characteristic curve shown in the oscilloscope trace below. The peak voltage is now 5V and the underswing is around -0.5V, both acceptable values. The mass of the steel plate also prolongs the signal, in this case to around 30 milliseconds, which will be much easier to detect in software.
As well as being ‘taller’, a harder hit also lasts longer than a soft one. This potentially gives another option for producing louder or softer MIDI sounds.
In the next part we’ll look at the software that turns these sensors into a percussion kit.