Sonic Interfaces: Build Your Own Experimental MIDI Instruments
In this hands-on elective, you will explore how sensors and microcontrollers can become musical instruments. You will learn the basics of programming, connect touch and motion sensors, and design your own MIDI controller. With software such as VCV Rack, you will experiment with unconventional inputs—touch, light, movement, sound—and transform them into live sonic expressions.
This elective introduces students to physical computing for sound. You will build DIY MIDI controllers that expand the language of performance beyond knobs and faders. The focus is on making and experimenting: coding, prototyping, and immediately testing your designs in music software.
Classes take place on location at the Interaction Station, combining small-group sessions and individual work. You can choose to collaborate on larger setups or develop your own custom instrument.
what is MIDI
what is a MIDI controller
how to build your own MIDI controller
To make our own MIDI controller, we need microcontrollers.
First things first: what is a microcontroller?
Computer and processor are generic terms for anything that can run a program, basically.
A controller or microcontroller usually refers to a simple processor that does only one task, like listening to sensors.
In explaining microcontrollers, we’ll distinguish them from computers, which contain more powerful processors that can run an operating system.
One of the most used microcontroller is Arduino. In this case though we will be talking about Adafruit Circuit Playground, a board with a hand design for several project.
Throughout this elective, we will use the microcontroller Adafruit Circuit Playground Express. why? Because we have a lot of them at the interaction station, there are numerous fun onboard sensors and Neopixel LEDs, and most importantly, they can be programmed as MIDI USB devices.
Adafruit Circuit Playground Express & Blue Fruit
The Circuit Playground Express(CPX) & Blue Fruit(CPB), produced by Adafruit, are microcontrollers, just like the Arduino Uno, but designed for wearable projects.
Thus, it is a little different from the normal boards from the hardware side, since the pins go out to those big, wide sewable pads, instead of normal pin headers (like on the Uno) .
Setting up CPX in Arduino IDE
Even though Adafruit Circuit Playground Express is not an Arduino native board but we can still program it using Arduino IDE.
To set up the board, you can follow the instructions here:
https://learn.adafruit.com/add-boards-arduino-v164/setup
After finishing installing the board, we also need some Libraries:
1. Adafruit Circuit Playground Library
2. Adafruit TinyUSB Library
Touch sensor example
#include <Adafruit_CircuitPlayground.h>
void setup() {
Serial.begin(115200);
CircuitPlayground.begin();
Serial.println("Touch test running...");
}
void loop() {
int val = CircuitPlayground.readCap(A1);
if (val > 1016) {
Serial.print("Touched! ");
}
Serial.print("Value: ");
Serial.println(val);
delay(50);
}
As you can see, when we touch the sensor, the reading reaches 1017. If we attach an aligater clip to the sensor pad without touching, it is reading 1016.
So in our code, we use an "if" statement to define the touch trigger.
We could add another sensor reading to our current code. like this:
#include <Adafruit_CircuitPlayground.h>
void setup() {
Serial.begin(115200);
CircuitPlayground.begin();
Serial.println("Touch test running...");
}
void loop() {
int val = CircuitPlayground.readCap(A1);
int val2 = CircuitPlayground.readCap(A2);
if (val > 1016) {
Serial.println("Touched! A1 ");
}
if (val2 > 1016) {
Serial.println("Touched! A2 ");
}
//Serial.print("Value: ");
//Serial.println(val);
delay(50);
}
However, there are in total of 7 touch sensors. If we add them individually, our code will become very long.
so let's try to use a for loop for this:
#include <Adafruit_CircuitPlayground.h>
const int touchPins[7] = {A1, A2, A3, A4, A5, A6, A7};
void setup() {
Serial.begin(115200);
CircuitPlayground.begin();
Serial.println("Touch test running...");
}
void loop() {
for (int i=0;i<7;i++){
int val =CircuitPlayground.readCap(touchPins[i]);
if (val > 1016) {
Serial.print("Touched! A");
Serial.println(i+1);
// Serial.print(" value:");
// Serial.println(val);
}
}
delay(20);
}
// cpx buttons to midi piano notes, you can find the reference on this webpage:
//https://studiocode.dev/resources/midi-middle-c/
#include <Adafruit_TinyUSB.h>
#include <MIDI.h>
#include <Adafruit_CircuitPlayground.h>
bool leftButtonPressed;
bool rightButtonPressed;
Adafruit_USBD_MIDI usb_midi;
MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
CircuitPlayground.begin();
TinyUSBDevice.begin();
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() {
// put your main code here, to run repeatedly:
// When buttons are pressed -> Note On, release -> Note Off
static bool left_last = false;
static bool right_last = false;
leftButtonPressed = CircuitPlayground.leftButton();
rightButtonPressed = CircuitPlayground.rightButton();
if (leftButtonPressed == true && left_last==false) {
MIDI.sendNoteOn(45, 100, 1); // A2 Button just pressed -> Note On
}
if (leftButtonPressed == false && left_last==true) {
MIDI.sendNoteOn(45, 0, 1); // A2 Button just released -> Note Off
}
left_last=leftButtonPressed;
if (rightButtonPressed==true && right_last==false) {
MIDI.sendNoteOn(48, 100, 1); // C3 Button just pressed -> Note On
}
if (rightButtonPressed==false && right_last == true) {
MIDI.sendNoteOn(48, 0, 1); // Button just released -> Note Off
}
right_last = rightButtonPressed; // Save state for next loop
delay(20);
}