All builds
Newest build

Air theremin

I move my hand and the note changes, without touching anything. An Arduino measures how far away my hand is and my Mac turns that into sound. With a version that helps me, I could play the first line of Twinkle Twinkle more or less.

Parts
Kit electronics
Board
Arduino Uno
Sensor
HC-SR04 distance
Sound
Made by the Mac
My real build: my hand in front of a distance sensor on a breadboard, wired to an Arduino Uno, with a ruler beside it

01What it is

Move your hand, the note changes.

A distance sensor on a breadboard measures how far away my hand is. The Arduino sends that number to my Mac, and my Mac turns it into sound. Closer is higher. I never touch it while I play.

Before you build it

It works a bit like a theremin, but it isn't a real one. My hand only changes the note. The Arduino only measures distance, so all the sound comes from the Mac. You need the Mac running the whole time you play.

  1. A ping goes out

    The sensor sends a sound too high for us to hear. One of the two round parts sends it and the other listens.

  2. The echo is timed

    The Arduino measures how long the echo takes to come back from my hand.

  3. Time becomes distance

    It uses the speed of sound, then divides by two because the sound goes there and back.

  4. The number goes to the Mac

    The Uno prints the distance in centimetres over the USB cable, one number per line.

  5. The Mac makes the note

    A small program passes each number to a page in the browser, and the page makes the sound.

02Parts

Sensor, board and four wires.

The electronics all came from my Arduino starter kit. There's nothing to solder, cut or glue.

PartHow manyNote
Arduino UnoMine is the Keyestudio one from the kit.1Reads the sensor
USB cableMy Mac also needs a USB-C adapter for it.1Power and numbers
Breadboard1Holds the sensor
Jumper wires4Power, ground, Trig, Echo
HC-SR04 distance sensorThe one with two round parts on the front. Its pins are marked Vcc, Trig, Echo and Gnd.1Finds your hand
A MacWith the Arduino IDE to upload the sketch, and Python 3 for the sound program.1Makes the sound
The parts on my desk: a breadboard, a Keyestudio Arduino Uno, an HC-SR04 distance sensor and two small buzzers
My parts before wiring. The USB cable and wires aren't in this photo. The two buzzers at the bottom ended up unused.

03Wiring

Four wires.

Safety first

Unplug the USB cable before you change any wire. Keep your Mac unplugged from its charger while the board is connected to it. I only power the board from the Mac's USB, with no battery pack.

Wiring: sensor Vcc to 5V, sensor Trig to pin 9, sensor Echo to pin 10, sensor Gnd to GND. Arduino Uno 5V910GND VccTrigEchoGndHC-SR04
The pins are drawn in sensor order, not where they sit on the Uno. The wire colours match mine: orange, green, yellow and white.
Sensor pinTo the Uno
Vcc5V My orange wire.
TrigPin 9 My green wire.
EchoPin 10 My yellow wire.
GndGND My white wire.
  1. Put the sensor in the breadboard

    With the USB out, push its four pins into row j, with the two round parts facing out past the edge. Each pin gets its own column.

  2. Add the four wires

    In row f of the same four columns, add one wire for each sensor pin. Then take each one to the Uno, following the table.

  3. Check every column

    The plugs sit close together and can hide each other. Check that each wire is level with the right sensor pin before you plug in the USB.

My wired build with the power on: the HC-SR04 sensor on the breadboard and four wires, orange, green, yellow and white, going to the Arduino Uno
My board powered up, with the whole circuit. In the photo at the top of this page, an old buzzer and a blue wire from my buzzer try are still on the board. The sound doesn't use them.

04Arduino code

The Uno measures the distance.

This is the sketch on my Uno. Claude gave me the code and I typed it in. Its only job is to print the distance in centimetres.

air_theremin.inoArduino IDE: pick Arduino Uno and your port, then UploadDownload
// Air theremin - step 2: show the hand distance on the Mac
// Wiring: sensor Trig -> pin 9, Echo -> pin 10

// 1. Give names to the two pin numbers
const int TRIG=9 ;
const int ECHO = 10;



void setup() {
  // 2. Start talking to the Mac, at speed 9600
  Serial.begin(9600);

// 3. Say which pin sends (output) and which one listens (input)
  pinMode(TRIG, OUTPUT);
  pinMode(ECHO,INPUT);


}

void loop() {
  // 4. Send one short ping: Trig off for a moment, on for 10 microseconds, off
  digitalWrite(TRIG,LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG,HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG,LOW);

  // 5. Measure how long the echo takes
  long echoTime =pulseIn(ECHO,HIGH);

  // 6. Turn that time into centimetres
   float cm =echoTime * 0.0343 / 2; 
  // 7. Print the number, then wait a little
  Serial.println(cm);
  delay(100);
}

05Mac sound

The Mac plays the notes.

Claude wrote this program, so I can't take the credit for it. It's two files: theremin.py reads the numbers from the Uno, and index.html is the page that makes the sound. They need to be in the same folder.

theremin.pyMac, Python 3, nothing extra to installDownload
#!/usr/bin/env python3
"""Air theremin, Mac side. Reads the distance the Uno prints (cm, one per line)
and passes it to a web page on this Mac that makes the sound. No extra installs.
The Uno's port can only be used by one program: stop this before uploading code."""
import base64
import glob
import json
import os
import select
import termios
import threading
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path

HTTP_PORT = 8777
PAGE = Path(__file__).resolve().parent / "index.html"
TAKES = Path(__file__).resolve().parent.parent / "takes"
latest = {"cm": None, "n": 0, "at": 0.0}
changed = threading.Condition()


def find_port():
    ports = sorted(glob.glob(os.environ.get("THEREMIN_PORT", "/dev/cu.usbmodem*")))
    return ports[0] if ports else None


def publish(cm):
    with changed:
        latest.update(cm=cm, n=latest["n"] + 1, at=time.time())
        changed.notify_all()


def read_uno():
    while True:
        port, fd = find_port(), None
        try:
            if port:
                fd = os.open(port, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
                a = termios.tcgetattr(fd)
                a[0], a[1], a[3] = 0, 0, 0
                a[2] = termios.CS8 | termios.CREAD | termios.CLOCAL
                a[4] = a[5] = termios.B9600
                termios.tcsetattr(fd, termios.TCSANOW, a)
                buf = b""
                while os.path.exists(port):
                    if not select.select([fd], [], [], 1)[0]:
                        continue
                    chunk = os.read(fd, 1024)
                    if not chunk:
                        break
                    *lines, buf = (buf + chunk).split(b"\n")
                    for line in lines:
                        try:
                            publish(float(line))
                        except ValueError:
                            pass
        except (OSError, termios.error) as error:
            print("Uno:", error, flush=True)
        finally:
            if fd is not None:
                os.close(fd)
        time.sleep(1)


def played_notes(events):
    """Turn the readings of one try into a list of notes: name, start and length in seconds."""
    notes = []
    for event in events:
        name, t = event["note"], event["t"]
        if notes and notes[-1]["end"] is None:
            if notes[-1]["note"] == name:
                continue
            notes[-1]["end"] = t
        if name:
            notes.append({"note": name, "start": t, "end": None})
    if notes and notes[-1]["end"] is None:
        notes[-1]["end"] = events[-1]["t"]
    return [{"note": n["note"], "start": round(n["start"], 2), "seconds": round(n["end"] - n["start"], 2)} for n in notes]


def save_take(take, folder=None):
    """Save one try: the clean sound (.webm) and what was played (.json)."""
    folder = folder or TAKES
    folder.mkdir(exist_ok=True)
    stem = base = time.strftime("take-%m%d-%H%M%S")
    count = 1
    while (folder / f"{stem}.json").exists():
        count += 1
        stem = f"{base}-{count}"
    (folder / f"{stem}.webm").write_bytes(base64.b64decode(take["audio"]))
    data = {"mode": take["mode"], "played": played_notes(take["events"]), "readings": take["events"]}
    (folder / f"{stem}.json").write_text(json.dumps(data, indent=1))
    return stem


class Handler(BaseHTTPRequestHandler):
    def do_POST(self):
        # JSON only: another website cannot send that here without permission this program never gives.
        size = int(self.headers.get("Content-Length") or 0)
        if self.path != "/take" or self.headers.get("Content-Type") != "application/json" or not 0 < size < 30_000_000:
            self.send_error(400)
            return
        try:
            name = save_take(json.loads(self.rfile.read(size)))
        except (KeyError, ValueError, TypeError, OSError) as error:
            print("Take not saved:", error, flush=True)
            self.send_error(500)
            return
        body = json.dumps({"saved": name}).encode()
        self.send_response(200)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(body)))
        self.end_headers()
        self.wfile.write(body)

    def do_GET(self):
        if self.path == "/":
            body = PAGE.read_bytes()
            self.send_response(200)
            self.send_header("Content-Type", "text/html; charset=utf-8")
            self.send_header("Content-Length", str(len(body)))
            self.send_header("Cache-Control", "no-store")
            self.end_headers()
            self.wfile.write(body)
        elif self.path == "/stream":
            self.send_response(200)
            self.send_header("Content-Type", "text/event-stream")
            self.send_header("Cache-Control", "no-store")
            self.end_headers()
            seen = -1
            try:
                while True:
                    with changed:
                        changed.wait_for(lambda: latest["n"] != seen, timeout=1)
                        seen = latest["n"]
                        data = {"cm": latest["cm"], "live": time.time() - latest["at"] < 1.5}
                    self.wfile.write(f"data: {json.dumps(data)}\n\n".encode())
                    self.wfile.flush()
            except (BrokenPipeError, ConnectionResetError):
                pass
        else:
            self.send_error(404)

    def log_message(self, *args):
        pass


def serve(http_port=HTTP_PORT):
    threading.Thread(target=read_uno, daemon=True).start()
    server = ThreadingHTTPServer(("127.0.0.1", http_port), Handler)
    server.daemon_threads = True
    return server


if __name__ == "__main__":
    print(f"Air theremin: http://localhost:{HTTP_PORT}", flush=True)
    serve().serve_forever()
index.htmlThe sound page. Keep it next to theremin.pyDownload
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Air theremin</title>
<style>
  * { box-sizing: border-box; margin: 0; }
  body { background: #f6efe4; color: #3b2a20; font: 18px/1.5 -apple-system, sans-serif;
         min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 24px; text-align: center; }
  .tag { font-size: 15px; opacity: .65; }
  #hz { font-size: clamp(56px, 15vw, 150px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
  #cm { font-size: 28px; font-variant-numeric: tabular-nums; }
  .track { width: min(640px, 86vw); height: 18px; border-radius: 9px; background: #e7dac6; overflow: hidden; }
  #bar { height: 100%; width: 0; background: #b8636d; }
  .buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
  button { font: 600 20px -apple-system, sans-serif; background: #3b2a20; color: #f6efe4; border: 2px solid #3b2a20; border-radius: 999px; padding: 14px 30px; cursor: pointer; }
  .modes button { background: transparent; color: #3b2a20; font-size: 16px; padding: 8px 18px; }
  .modes button.active { background: #3b2a20; color: #f6efe4; }
  #keys { display: none; grid-template-columns: repeat(6, 1fr); gap: 8px; width: min(640px, 92vw); }
  .key { background: #e7dac6; border-radius: 14px; padding: 14px 0; font-size: 34px; font-weight: 700; }
  .key small { display: block; font-size: 13px; font-weight: 400; opacity: .75; }
  .key.lit { background: #b8636d; color: #fff8ee; }
  body.notes #keys { display: grid; }
  body.raw #voices { display: none; }
  body.notes .track { display: none; }
  #rec { background: #b8636d; border-color: #b8636d; }
  #rec.on { background: transparent; color: #8f3f4b; }
  #status { min-height: 1.5em; font-size: 16px; }
</style>
</head>
<body>
  <p class="tag" id="version"></p>
  <div id="hz">-</div>
  <div id="cm">Waiting for the Uno</div>
  <div class="track"><div id="bar"></div></div>
  <div id="keys"></div>
  <div class="buttons">
    <button id="go">Start sound</button>
    <button id="rec">● Record try</button>
  </div>
  <div class="buttons modes">
    <button data-mode="raw">1 · Raw</button>
    <button data-mode="smooth">2 · Smooth</button>
    <button data-mode="notes">3 · Notes</button>
  </div>
  <div class="buttons modes" id="voices">
    <button data-voice="soft">Soft</button>
    <button data-voice="violin">Violin</button>
    <button data-voice="flute">Flute</button>
  </div>
  <p id="status"></p>
  <p class="tag" id="help"></p>
<script>
// Version 1 (raw): harsh square wave that jumps straight to every new reading.
// Version 2 (smooth): middle of the last 3 readings (drops single wild jumps),
// the note slides to the new pitch, soft fades, softer triangle wave.
// Version 3 (notes): like 2, but the hand picks one of six real notes (C to A).
// Each note owns 4 cm, C farthest. A note is kept until the hand is 0.7 cm past its edge.
const NOTES = [['C', 261.63], ['D', 293.66], ['E', 329.63], ['F', 349.23], ['G', 392], ['A', 440]];
const END = 29, STEP = 4, STICKY = 0.7;
function noteFor(cm, current) {
  if (current !== null && Math.abs(cm - (END - STEP * (current + 0.5))) <= STEP / 2 + STICKY) return current;
  return Math.min(NOTES.length - 1, Math.max(0, Math.floor((END - cm) / STEP)));
}
const NEAR = 5, FAR = 28, HIGH = 880, LOW = 220;
const GLIDE = 0.07;      // seconds; bigger = slower slide or fade
let audio, osc, gain, master, tap, recorder = null, events = [], recStart = 0, recTimer, syncBeep = true, on = false, mode = 'notes', note = null, sounding = false, lastMessage = 0, recent = [];
const $ = id => document.getElementById(id);
const median = values => [...values].sort((a, b) => a - b)[Math.floor(values.length / 2)];

const smooth = () => mode !== 'raw';

// Sounds for versions 2 and 3. They are made by the Mac to resemble an instrument, not recordings of one.
// body: a boost at one pitch area; cut: removes what is above it; vibrato: gentle pitch wobble in cents.
const VOICES = {
  soft:   { wave: 'triangle', level: 0.18, fade: 0.03, vibrato: 0,  body: 0, cut: 20000 },
  violin: { wave: 'sawtooth', level: 0.10, fade: 0.07, vibrato: 18, body: 9, cut: 3600 },
  flute:  { wave: [1, 0.22, 0.07, 0.02], level: 0.20, fade: 0.05, vibrato: 7, body: 0, cut: 5000 },
};
let voice = 'violin', body, tone, wobble, wobbleDepth;

function useVoice() {
  if (!osc) return;
  const v = smooth() ? VOICES[voice] : { wave: 'square', vibrato: 0, body: 0, cut: 20000 };
  if (typeof v.wave === 'string') osc.type = v.wave;
  else osc.setPeriodicWave(audio.createPeriodicWave(new Float32Array([0, ...v.wave.map(() => 0)]), new Float32Array([0, ...v.wave])));
  body.gain.value = v.body;
  tone.frequency.value = v.cut;
  wobbleDepth.gain.value = v.vibrato;
}
const NAMES = { raw: 'version 1: raw', smooth: 'version 2: smooth', notes: 'version 3: notes' };

NOTES.forEach(([name], i) => {
  const key = document.createElement('div');
  key.className = 'key';
  key.innerHTML = `${name}<small>${END - STEP * (i + 0.5)} cm</small>`;
  $('keys').append(key);
});
const light = index => [...$('keys').children].forEach((key, i) => key.classList.toggle('lit', i === index));

function showMode() {
  $('version').textContent = 'Air theremin · ' + NAMES[mode];
  document.querySelectorAll('[data-mode]').forEach(b => b.classList.toggle('active', b.dataset.mode === mode));
  document.body.classList.toggle('notes', mode === 'notes');
  $('help').textContent = mode === 'notes'
    ? 'Six notes, 4 cm each. Closer is higher. Farther than 29 cm is silent.'
    : 'Play between 5 and 28 cm. Closer is higher. Farther than 28 cm is silent.';
  document.body.classList.toggle('raw', mode === 'raw');
  document.querySelectorAll('[data-voice]').forEach(b => b.classList.toggle('active', b.dataset.voice === voice));
  useVoice();
}

function set(param, value, time) {
  const now = audio.currentTime;
  param.cancelScheduledValues(now);
  if (time) { param.setValueAtTime(param.value, now); param.setTargetAtTime(value, now, time); }
  else param.setValueAtTime(value, now);
}

function silence() {
  if (gain) set(gain.gain, 0, smooth() ? VOICES[voice].fade : 0);
  sounding = false;
}

function play(hz) {
  // Coming out of silence, start on the right note instead of sliding from the old one.
  // Notes land quickly so each one sounds clean.
  set(osc.frequency, hz, smooth() && sounding ? (mode === 'notes' ? 0.015 : GLIDE) : 0);
  set(gain.gain, smooth() ? VOICES[voice].level : 0.08, smooth() ? VOICES[voice].fade : 0);
  sounding = true;
}

$('go').onclick = async () => {
  if (!audio) {
    audio = new AudioContext();
    osc = audio.createOscillator();
    gain = audio.createGain();
    gain.gain.value = 0;
    master = audio.createGain();
    tap = audio.createMediaStreamDestination();   // clean copy of the sound for recording
    body = audio.createBiquadFilter(); body.type = 'peaking'; body.frequency.value = 900; body.Q.value = 1.2;
    tone = audio.createBiquadFilter(); tone.type = 'lowpass';
    wobble = audio.createOscillator(); wobbleDepth = audio.createGain();
    wobble.frequency.value = 5.6;
    wobble.connect(wobbleDepth).connect(osc.detune);
    wobble.start();
    osc.connect(body).connect(tone).connect(gain).connect(master);
    master.connect(audio.destination);
    master.connect(tap);
    showMode();
    osc.start();
  }
  await audio.resume();
  on = !on;
  if (!on) silence();
  $('go').textContent = on ? 'Stop sound' : 'Start sound';
};

document.querySelectorAll('[data-mode]').forEach(button => button.onclick = () => {
  silence(); mode = button.dataset.mode; recent = []; note = null; light(null); showMode();
});
document.querySelectorAll('[data-voice]').forEach(button => button.onclick = () => {
  silence(); voice = button.dataset.voice; showMode();
});
showMode();

new EventSource('/stream').onmessage = event => {
  const { cm: reading, live } = JSON.parse(event.data);
  lastMessage = Date.now();
  if (!live || reading === null) {
    recent = []; note = null; light(null); silence();
    $('hz').textContent = '-'; $('cm').textContent = 'Waiting for the Uno'; $('bar').style.width = '0';
    return;
  }
  recent = [...recent, reading].slice(-3);
  const cm = smooth() ? median(recent) : reading;
  $('cm').textContent = cm.toFixed(1) + ' cm';
  const playing = cm >= 2 && cm <= (mode === 'notes' ? END : FAR);
  const position = Math.min(1, Math.max(0, (cm - NEAR) / (FAR - NEAR)));
  let hz = HIGH * Math.pow(LOW / HIGH, position);
  let label = Math.round(hz) + ' Hz';
  if (mode === 'notes') {
    note = playing ? noteFor(cm, note) : null;
    light(note);
    if (playing) [label, hz] = NOTES[note];
  }
  $('hz').textContent = playing ? label : '-';
  $('bar').style.width = playing ? (100 - position * 100) + '%' : '0';
  if (on && playing) play(hz); else silence();
  if (recorder) events.push({ t: (performance.now() - recStart) / 1000, cm, note: on && playing && mode === 'notes' ? NOTES[note][0] : null, hz: on && playing ? Math.round(hz) : null });
};

// Record one try: the clean sound straight from the page, plus every reading and note.
function beep() {
  // A short marker at the start, to line the clean sound up with the phone video.
  const marker = audio.createOscillator(), level = audio.createGain();
  marker.frequency.value = 1500; level.gain.value = 0.12;
  marker.connect(level).connect(master);
  marker.start(); marker.stop(audio.currentTime + 0.12);
}

const base64 = blob => new Promise(done => {
  const reader = new FileReader();
  reader.onload = () => done(reader.result.split(',')[1]);
  reader.readAsDataURL(blob);
});

$('rec').onclick = () => {
  if (recorder) { recorder.stop(); return; }
  if (!on) { $('status').textContent = 'Click Start sound first.'; return; }
  const chunks = [], takeMode = smooth() ? mode + '-' + voice : mode;
  recorder = new MediaRecorder(tap.stream, { audioBitsPerSecond: 192000 });
  recorder.ondataavailable = e => chunks.push(e.data);
  recorder.onstop = async () => {
    clearTimeout(recTimer);
    const takeEvents = events;
    recorder = null;
    $('rec').textContent = '● Record try'; $('rec').classList.remove('on');
    $('status').textContent = 'Saving…';
    try {
      const reply = await fetch('/take', { method: 'POST', headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ mode: takeMode, events: takeEvents, audio: await base64(new Blob(chunks)) }) });
      if (!reply.ok) throw new Error(reply.status);
      $('status').textContent = 'Saved: ' + (await reply.json()).saved;
    } catch (error) { $('status').textContent = 'NOT saved. Tell Claude. (' + error.message + ')'; }
  };
  events = []; recorder.start(); recStart = performance.now();
  if (syncBeep) beep();
  recTimer = setTimeout(() => recorder && recorder.stop(), 120000);
  $('rec').textContent = '■ Stop recording'; $('rec').classList.add('on');
  $('status').textContent = 'Recording your try (stops by itself after 2 minutes)';
};

// If the Mac program stops, do not leave a note hanging.
setInterval(() => { if (Date.now() - lastMessage > 2500) silence(); }, 500);
</script>
</body>
</html>

The page has three versions, and you can switch between them with one click. I built them in this order.

1. RawA harsh sound that jumps to every new reading. You play between 5 and 28 cm.
2. SmoothIt takes the middle one of the last three readings, so one strange number is ignored. It slides between sounds and is softer.
3. NotesSix notes from C to A, 4 cm each. It keeps a note until your hand is 0.7 cm past its edge.
Note in version 3Where your hand is, from the sensor
C25 to 29 cm
D21 to 25 cm
E17 to 21 cm
F13 to 17 cm
G9 to 13 cm
ACloser than 9 cm Closer than 2 cm is silent, and so is farther than 29 cm.

Versions 2 and 3 can play as Soft, Violin or Flute. The violin and flute aren't recordings of real instruments. The Mac makes those sounds, and they're only meant to be similar.

06How to run it

From upload to first note.

  1. Upload the sketch

    Wire it with the USB out, then plug it in. Open air_theremin.ino in the Arduino IDE, pick Arduino Uno and your port, and press Upload.

  2. Check the numbers

    Open the Serial Monitor at 9600 and move your hand in front of the sensor. The number should follow it. I checked mine with a ruler. Then close the Serial Monitor.

  3. Put the two files together

    Make a folder called air-theremin with a folder called mac inside it. Put theremin.py and index.html in mac.

  4. Start the program

    In Terminal, go into the air-theremin folder and run python3 mac/theremin.py. Leave that window open. Then open http://localhost:8777 in your browser.

  5. Press Start sound

    It opens on version 3 with the violin. Move your hand toward the sensor and the lit tile shows which note you're on.

  6. Stop it before you upload again

    Only one program can use the Uno's port. Press Control and C in Terminal before you upload code.

The program looks for a port called /dev/cu.usbmodem followed by a number. If your board shows up with a different name, start it like this, with your own port: THEREMIN_PORT=/dev/cu.yourport python3 mac/theremin.py

07My teacher

A music teacher that can't hear.

I wanted Claude to teach me, but it can't hear me play. So it added a Record try button. It saves the sound, plus a list of the notes I played and when I played them. Claude reads the list and gives me one thing to fix.

The lesson

C C G G A A G

That's the first line of Twinkle Twinkle Little Star. My first recording had two tries. In the first, I played F in places where I needed G. In the second, all seven notes came in order, with one tiny wrong note before the first G.

The one fix: bring my hand in already at the G spot, about 11 cm from the sensor.

The next recording

One good stretch

It had wrong notes in it, but one part has all seven notes in order. The first C there is really short, and there's a quick G just before the first A.

Both results come from the saved list of notes.

To try it, record one go. The sound and the list are saved in air-theremin/takes, and a recording stops by itself after 2 minutes. A short beep marks the start. Then ask Claude to read the newest .json file there, compare it with the line you want, and give you one fix. This needs a Claude that can open files on your Mac, or you can attach the file to a chat.

08What went wrong

The buzzer never played.

The plan was to make the sound with a small buzzer from the kit.

  • The first upload didn't work. The code had no errors, but my Mac didn't see the Arduino. I plugged it in again and it uploaded.
  • I wired the buzzer wrong. One of Claude's instructions wasn't clear, and I put the ground wire in the same column as the resistor. Wired like that, the signal goes straight past the buzzer.
  • Then there was only one leg. Each of my two buzzers seemed to have only one leg. We checked one in photos. I didn't repair or solder anything. The sound moved to the Mac, so you don't need a buzzer or pin 8.
  • Version 1 didn't sound like the song. You could hear it follow my hand, but my Twinkle didn't come out.
  • Version 2 was still too hard. It sounded a bit different, but it was really hard to land on a note.
  • The phone made it sound strange. In my iPhone videos the notes stutter in a way they didn't in the room. I haven't checked why.
The underside of one small black buzzer, with a thin loose wire lying next to it on the desk
One buzzer from underneath, and a loose wire beside it.

09Limits

Can I play it?

I'm not good at it yet. I can get through the first line of one song, more or less, with the version that helps me.

  • Version 3 helps a lot. I don't have to find the exact sound. I only have to get my hand into the right space. Even with a ruler to find the spots, my playing wasn't exact.
  • Only six notes. Version 3 goes from C to A, so a song that needs any other note won't fit.
  • Your hand only picks the note. This build has one sensor, and it doesn't control how loud the sound is.
  • It needs the Mac. The Uno makes no sound by itself.
  • One fix isn't a test of a teacher. Claude gave me one fix, so I can't say how good a teacher it is. It worked from a list of notes, and that was enough to give me something to practise.
  • I only ran it on my own Mac. I haven't checked it on Windows, on another Mac or in every browser.