The Monodrone, Part II

This post is part of a series of notes and exercises for a summer camp on making musical instruments with Arduino and Pure Data.

Now we’ll use Pure Data to generate some MIDI notes when the button is pressed. Start by assembling this patch that reads from the serial port:

Test that you can get numbers from the Arduino. We’ll use the trigger later.

When we see a 1 on the serial port, we want to start sounding a MIDI note. When we see a 0, we want to stop the note. We can use the noteout object to both start and end the note.

Add a single noteout object at the bottom of your patch. It has these three inlets:

  1. The note’s MIDI number.
  2. The velocity, which quantifies the note’s “force.”
  3. The channel, which can be used to channel the note to different MIDI instruments. We only have one instrument (VMPK), so we can ignore this inlet.

Add three number boxes right above the noteout. The first will be the note number. The second will be the velocity of a new note. The third will be 0. When Pure Data sees a velocity of 0, it stops playing a note.

Connect the note number to the first inlet of noteout. Connect both the velocities to the second inlet.

To choose which of the two velocities will get pushed to noteout, we’ll use a select object. We pass select a list of numbers. It will have an outlet for each number we include in the list. When a float comes from the trigger through its inlet, it sends a bng out along the outlet that corresponds to the matching number found in the list.

In our case, our list of numbers is just 0 and 1. We wire up the outlets so that when a 0 is seen, we issue a bng to the stop velocity. When a 1 is seen, we issue a bng to the new note velocity.

All told, our patch looks something like this:

Note how we wire up the the bng outlet of the trigger to force an update to the note number. Without that, a button press will not trigger a new note—as the velocities are only connected to cold inlets.

Test your circuit. Don’t forget to open VMPK and set Pure Data’s MIDI output to IAC Driver Bus 1 via Media / MIDI Settings. You should be able to drone monotonously by pressing the button. But it probably sounds pretty echo-y. We’ll fix that in the next exercise.


After you get your monodrone working, answer the following questions on a piece of scratch paper.

  1. Experiment with different instruments in VMPK. What differences do you notice in how velocity affects different instruments?
  2. For what do you suppose the third outlet is on the select? After making a hypothesis, control-click on it and choose Help to see its documentation and validate your hypothesis.
  3. What are some ways you can invert the instrument—that is, have it play when no button is pressed, and go silent when a button is pressed?


Leave a Reply

Your email address will not be published. Required fields are marked *