Spatial Theremin

An instrument played by hand distance across a 25-speaker dome.

The patch, running. Distances arrive every 33 ms, a hand’s height recalls one of eight spatial scenes, and the sources glide there in half a second.
Role
Independent Project
Timeline
Sep–Dec 2024
Type
  • Physical Computing
  • Sound
  • Interaction
Tools
  • Max/MSP
  • Arduino
  • Reaper
  • Audacity

Overview

Spatial Theremin is an instrument you play without touching it. Two ultrasonic sensors measure how far away the hand is. One reading shapes the sound. The other moves it: eight sound sources travel through a 25-speaker dome as the hand rises and falls.

Context
Independent project, Sep–Dec 2024. Performed on the 25.4 Loudspeaker Array in RISD’s Studio for Research in Sound and Technology.
I made
The sensor rig, the Max/MSP patch, the sound palette and a five-minute performance.
Signal path
Arduino → Max/MSP → third-order ambisonics → 25 speakers and 4 subwoofers.

The move

A theremin changes what you hear. This one changes where you hear it.

The project starts from embodied interaction and listening. The gesture doesn’t trigger a sound; it steers one through the room. Perception, interface and space have to work together for the instrument to mean anything.

The Instrument

Two HC-SR04 ultrasonic sensors sit on a breadboard, wired to an Arduino Uno. Each one sends out a pulse and times the echo off the hand. The board streams both distances to Max over USB.

Circuit diagram: two HC-SR04 ultrasonic sensors on a breadboard, wired with colored jumpers to an Arduino Uno with a USB cable
The circuit.

Turn an echo into centimeters

Each loop fires a 10 µs trigger pulse and measures how long the echo pin stays high. Sound covers about 0.0343 cm per microsecond and travels there and back, so distance is duration × 0.0343 ÷ 2. A missing echo, or one longer than 46 ms, is thrown away and the last good reading is kept. Pulling a hand out of range freezes the instrument instead of sending garbage into the room.

const int trigPin1 = 9;
const int echoPin1 = 10;
const int trigPin2 = 5;
const int echoPin2 = 6;

float lastValidDuration1 = 0;
float lastValidDuration2 = 0;

void loop() {
  digitalWrite(trigPin1, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin1, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin1, LOW);
  duration1 = pulseIn(echoPin1, HIGH);

  if (duration1 > 46000 || duration1 <= 0) {
    duration1 = lastValidDuration1;
  } else {
    lastValidDuration1 = duration1;
  }
  distance1 = (duration1 * 0.0343) / 2;

The Patch

The Max/MSP patch does three jobs: it reads the sensors, decides what each distance means, and places the sound in space.

Reading

A metro 33 polls the serial port about 30 times a second. sel 13 10 cuts the byte stream at each line break, and zl group, itoa and fromsymbol turn it back into a message such as Distance1: 18.89. route sends each sensor down its own column.

Mapping

Each column passes readings under 223 cm and drops the rest. A line object glides to every new value over 500 ms, so sensor jitter never reaches the speakers. From there the two readings split up. One is scaled from 0–22 cm onto the controls of a granulator, the texture of the sound. The other is cut by eight split objects into 5 cm bands: 1–5, 5.1–10, up to 40 cm. change lets a band number through only when the hand crosses into a new band.

Detail of the Max patch on its blue canvas: serial and route objects on the left, two columns with less-than-223 gates and line sliders, and eight split objects fanning into a change object
Reading and mapping: serial in on the left, the two sensor columns, and the eight 5 cm bands converging on change.

Placing

The band number recalls one of eight stored scenes in an ambimonitor, a map of where each sound source sits. The patch moves the sources to the new scene over 500 ms (pack 0 500 0). The sources are eight channels: six from a prepared multichannel file and two from the live granulator, through a comb filter. mc.ambiencode~ 3 8 encodes them into third-order ambisonics, 16 channels that describe the whole sound field, and mc.send~ hands them to the decoder for the room.

Detail of the Max patch: mc.sfplay, unpack and pack objects feeding mc.ambiencode 3 8, a 16-channel send-level meter, and an ambimonitor with top and side views showing eight numbered sources on a ring, with STORE and RECALL controls on the right
Placing: eight channels into the ambisonic encoder, the ambimonitor with its top and side views, and the STORE / RECALL presets.

Decisions

  1. Steps, not a slide

    Height is cut into eight 5 cm bands. A position in the air becomes a place the performer can find again, and the room only rearranges when the hand crosses a line.

  2. Glide, never jump

    Distances ease in over 500 ms, and so do scenes. A shaky reading can’t make a sound teleport or click.

  3. Leaving holds still

    Bad echoes are dropped on the Arduino and gated again in Max. Taking the hand away freezes the last state instead of throwing sound across the room.

Sound

I built the sound palette in a hybrid workflow, moving between a DAW and patch-based processing before committing any mapping in Max.

Sound workflow

  1. Audacity session with several tracks of clipped and edited recordings

    Palette

    Field recordings, sampled and edited in Audacity: cleaning, cutting, normalizing, filtering.
  2. Small Max patch reading a drone file into a buffer and scanning it with two phasors through 2d.wave~

    Instability

    Time-based and spectral treatments for motion and instability: time-stretching, pitch shifting, textural processing.
  3. Reaper session with multiple tracks of audio regions and colored automation lanes

    Space

    Spatial effects in Reaper, such as delay-based depth cues and stereo encoding, before the mappings went into Max.
IEM StereoEncoder plug-in: a circular panner with a source placed at the left rear, azimuth −112.5°, elevation 180°, and quaternion sliders
IEM DualDelay plug-in: two columns of knobs for rotation, delay, LFO, spectral filter cutoffs, feedback and output mix

Spatial effects in Reaper, with the IEM plug-ins at third order: StereoEncoder sets azimuth, elevation and width; DualDelay rotates and filters two delay lines.

Sampler app on a phone with a grid of sixteen waveform pads and volume, pitch and pan knobs
A large modular synthesizer in a wooden case, its panels covered in knobs and patch points
Close-up of a hand turning a knob on a modular synthesizer patched with orange and green cables

Sources for the palette: pads in a sampler app and the studio’s modular synthesizer.

The live voice runs through a granulator and a comb filter inside the patch. The scaled distance plays it directly.

Detail of the Max patch: the GRANUL8R module with speed, grain rate, jitter, transpose, width and grain envelope controls, connected to a COMBR comb-filter module
The live voice: granulator into comb filter.

Performance

I performed the piece in RISD’s Studio for Research in Sound and Technology (SRST), on its 25.4 Loudspeaker Array: 25 Genelec monitors in a hemisphere around and above the audience, plus four subwoofers. Every speaker can be addressed on its own. In ambisonics the sound is described as a field rather than as speaker feeds, so the patch doesn’t care how many speakers there are: the decoder spreads the same 16 channels across all 25, and would spread them across a different room just as well.

Black-box studio with rows of chairs facing a mixing desk, surrounded by speakers on stands and overhead
Wireframe diagram in green: speaker positions as dots on a dome, linked by lines

SRST and a vector diagram of its loudspeaker array. Images: RISD Sound.

Performance recording, 4:54.