This post is part of a series of notes and exercises for a summer camp on making musical instruments with Arduino and Pure Data.
Currently our chorder writes messages like this to the serial port:
60 62 64 0
This looks like a I chord in the C major scale. The 0 means it should stop playing.
We now write a Pure Data patch that interprets these messages and generates the appropriate MIDI commands.
Let’s start by making an abstraction that plays or stops a particular MIDI note. Call it
note2. It will behave a lot like
note from our pentatouch. Create it in the following way:
inletfor the note’s MIDI number.
inletfor the note’s state, which will be 0 or 1.
selectobject that chooses between 0 and 1.
float 0object. Recall a velocity of 0 means the note will stop playing.
float 100object. There’s nothing special about 100. Use any non-zero velocity.
Save your abstraction in
note2 in place, creating the main patch will be much simpler. Follow these steps:
closemessages as you have done previously.
comport 9600object and wire the messages to it as you have done previously.
repack 4object. Each message has four numbers in it.
unpack float float float floatobject. This separates the message into four individual numbers.
note2object. And the third.
Test your instrument. Touching the clips should produce I, ii, iii, VI, V, vi, and vii chords. Then find some fruit and vegetables to create your inputs.
After you get your chorder working, answer the following questions on a piece of scratch paper.