This is like a “hello world” for the Arduino.
If Blink runs okay, then you’re in business. If it doesn’t,
then there may be something wrong with your setup or
the Uno board. There is plenty of documentation and help
available on the website.
You can find the software for the MIDI lyre with the
article downloads. Grab the file and import it into the web
editor using the Import button. From there, you can
upload it to the Uno. Once it’s uploaded, connect the lyre
to your MIDI instrument. If you touch and release a string,
it should play something.
Warning: If you have your MIDI instrument connected
while you are uploading the software, odd things will
happen! This is because on the Uno the same serial port
is used for MIDI and for USB. Therefore, to prevent
spurious MIDI messages, always turn off or disconnect
your MIDI instrument before uploading software!
If you take a look at the software, you’ll see that there
are three global variables that you can customize. The first
variable is tonic. This sets the key in which the lyre is
tuned, according to Table 4.
The next variable is octave. As you might expect, this
sets the octave in which the lyre will play. You can see
how it is manipulated by the Octave Up and Octave
Down buttons in the corresponding octaveUp( ) and
octaveDown( ) functions.
The default octave is 5, which is a nice treble range,
but, for example, you could instead default to a bass
instrument by setting the octave to 3 or 4.
Finally, we have an integer array called
majorScaleOfsets[ ]. This controls the pitch of each string
relative to the tonic. Each integer in this array is the
number of semitones that a string differs from the tonic. In
the default tuning of the lyre, the tonic is C which is on
string number 4 (remember that the strings are numbered
from 0 to 11 to match the MPR121 electrodes). So, we
majorScaleOfsets[ 3 ] = 0
String 0 is the first string; this is tuned to the G below
the tonic, so majorScaleOfsets[ 0 ] = - 5, because G is five
semitones below C.
You should now be able to see that by changing the
values in majorscaleOffsets[ ], you can completely change
the scale of the MIDI lyre.
For example, you might change it to play in a minor
scale or even a chromatic scale (after all, there are 12
strings!). The current limitations of the software are that
there must be zero or more semitones between each
string, and each semitone is of equal size according to
normal Western tuning, which is 12-tone equal
temperament (i.e., 12 semitones in an octave where each
semitone is the same size).
The software could easily be modified to play in
different temperaments by sending MIDI pitch bend
messages with each note. However, this is something for a
follow-up project. If you’re interested in non-standard
temperaments, then you should check out Scala at
Operation and Testing of
the MIDI Lyre
When you power-up the lyre, the Uno’s built-in LED
will flash 25 times. Do not touch the strings during this
time because the MPR121 is calibrating itself against
background capacitance (no touch)! If the LED never
stops flashing, then you have an error communicating with
the MPR121, and you should check all your wiring.
Once the LED has stopped flashing, you can connect
your MIDI instrument if you have not already done so. If
you touch and release a string, the instrument should play
Remember that the MIDI lyre does not send Note Off
messages. Therefore, if you select a voice that has infinite
sustain, the note will just continue to play.
The lyre only works with voices that die away
naturally, such as piano, guitar, any plucked instrument, or
tuned percussion such as tubular bells or gamelan.
If you have installed the Octave Up and Octave Down
buttons, pressing Octave Up will take the lyre up one
octave; pressing Octave Down will take it down one
There are two important points to note about this:
Firstly, not all voices work well at every octave; and
secondly, changing the octave affects the next note to
The MIDI Association.
Everything about MIDI.
Details on the Adafruit
MPR121 breakout board.
Everything about the
The Arduino Web Editor.
Scala software for non-standard temperaments.
Key C C# Db D D# Eb E F F# Gb G G# Ab A A# Bb B
32 July/August 2018