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:
inlet midi_numberfor the note’s MIDI number.
inlet statefor the note’s state, which will be 0 or 1.
selectobject that chooses between 0 and 1.
float 0object, which will serve as the stopping velocity.
float 100object, which will serve as the playing 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.