teaching machines

Machine Setup for Computational Music

April 24, 2019 by . Filed under electronics, music, public.

This coming summer I’m leading a summer camp on digital music and sound generation. There are many steps to get the computers set up, and I record them here to share with helpful system administrators and my future self.

Software to Install

The following is a list of the base software that needs to be installed:

Configuration and Testing

Once the software is installed, some of it needs to be configured and all of it should be tested. The following steps should be followed in order.

macOS

The operating itself needs to be set up to allow MIDI commands to pass between applications. The following steps create a bridge for inter-application communication (IAC):

  1. Ensure that VMPK and Pure Data are not open.
  2. Hit Command-Space and enter Audio MIDI Setup.
  3. Click Window / Show MIDI Studio.
  4. Double-click IAC Driver.
  5. Toggle Device is online on.
  6. In Ports, ensure at least one port is available. Add one if necessary. The name of the port isn’t important.
  7. Quit Audio MIDI Setup. It doesn’t need to remain open.

VMPK

We set up VMPK to receive MIDI commands with the following steps:

  1. Open Virtual MIDI Piano Keyboard.
  2. Click Edit / MIDI Connections
  3. Check Show Advanced Connections.
  4. Set MIDI IN Driver to CoreMIDI.
  5. Set Input MIDI Connection to IAC Driver Bus 1—or whatever you named the port earlier.

Pure Data

We set up Pure Data to send MIDI commands with the following steps:

  1. Open Pure Data.
  2. Click Media / MIDI Settings.
  3. Click the button under Output Devices, select VMPK Input, and hit OK.

We test whether the IAC bridge is working by programming a Pure Data patch to issue MIDI commands:

  1. Download the patch test_midi.pd.
  2. Open the patch in Pure Data. It should look like this:
  3. Drag on the number box in your patch to hear a slur of notes triggered by Pure Data and played by VMPK.

Additionally, we need a couple of helper packages to make writing patches easier:

  1. Install the zexy package, which makes talking to Arduino over the serial port a bit easier. The easiest way to install it is through builtin package manager. Access it via Help / Find Externals, search for zexy, and install the most recent version. If you are a system administrator, it might be easier to mass install it by downloading the source and extracting it to the right directory.
  2. Test the zexy installation with the patch test_zexy.pd:
    Click on the top message containing a list of letters to run the patch. If the installation has worked, zexy’s repack command will parcel the list into 2-tuples, which you’ll see printed in Pure Data’s console window like this:
    print: list A B
    print: list C D
    print: list E F
  3. Install the comport package in the same manner as zexy.
  4. Test the comport installation with the patch test_comport.pd:
    Click on the devices message to see a list of available serial ports. It may take a few seconds to run. The list will likely be quite boring unless you have an Arduino board plugged in.

Arduino

The Arduino boards that we use are Adafruit Metros. Unlike official Arduinos, the Metros contain an FTDI chip and serial port hardware that require special drivers on macOS. Adafruit provides some instructions, but in short, we need these two driver packages installed:

Beyond have an Adafruit Metro on hand, I don’t know of an easy way to test whether these drivers installed correctly.

Sonic Pi

Sonic Pi should work properly out of the box. Run this code from the examples to test it:

live_loop :haunted do
  sample :perc_bell, rate: rrand(-1.5, 1.5)
  sleep rrand(0.1, 2)
end