Skip to content

Give the Matrix a soundtrack, and the pod a heartbeat - #5

Merged
h1ddenpr0cess20 merged 1 commit into
mainfrom
claude/hopeful-bell-p4g7lu
Sep 22, 2026
Merged

h1ddenpr0cess20 merged 1 commit into
mainfrom
claude/hopeful-bell-p4g7lu

Conversation

@h1ddenpr0cess20

Copy link
Copy Markdown
Owner

What it sounds like

Psytrance in E minor, round Em Em C C Am Am F B. The F sits a semitone above home, which is what makes it sound like the code is wrong.

  • The run builds with depth. Kick and a rolling bass off the line. At 100 m the hats, the clap and the "green rain" come in: square-wave plinks, three notes against four beats. At 300 m, pads and data bleeps. At 600 m, the lead.
  • An agent muffles the music for a second.
  • System failure is a chord outside the key and a saw powering down.
  • Between runs it's the pod: the same chords slowed right down, over a heartbeat.

How it works

There are no audio files. src/ui/music.js is a step sequencer. It reads parts written as strings, one token per sixteenth note (e2 - . e3+g3+b3), and plays them on instruments made of oscillators and noise. It runs on the AudioContext that sound.js already builds. src/ui/soundtrack.js is this game's composition. music.js is the same file in all four egg games.

  • Nothing before a gesture. sound.js now exposes its context and a wake() method. The first touch or key press anywhere wakes the audio, so the title music can play before the first run.
  • Scheduled ahead. Notes are queued ahead on the audio clock. The queue reaches further when frames are slow. After a stall, the missed notes are dropped and playback stays on the beat grid.
  • Bar lines. New layers only come in at the start of a bar.
  • Mute. M mutes the music, and it keeps time while muted.
  • README. It has a new "The soundtrack" section.

Testing

  • npm test: 98 pass, including new tests.
    • test/music.test.js runs against a fake AudioContext. It covers staying on the grid, stalls, slow frames, mute, layers entering at bar lines, a one-shot cue handing off to the next, and nodes being disconnected once they finish. The slow-frame test fails without the look-ahead fix.
    • test/soundtrack.test.js checks the composition: whole bars, real instruments, every cue main.js asks for, and a full title → run → over run on the real parts.
  • npm run lint is clean, and npm run build succeeds.
  • I ran the actual game in headless Chromium. No AudioContext is created before the click, the music plays after pressing play, muting stops new notes, and there were no page errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GMNb8MBDZFeHduLGsa6wYH


Generated by Claude Code

Psytrance in E minor, round Em Em C C Am Am F B — the F a semitone
above home is what makes it sound like the code is wrong. It builds
with depth: kick and rolling bass off the line, hats, clap and the
green rain at 100m, pads and bleeps at 300m, the lead at 600m. An agent
muffles it for a second, system failure is a chord out of the key and
the power draining out of a saw, and between runs it is the same chords
slowed right down over a heartbeat.

The engine is src/ui/music.js, the same file in all four eggs: a step
sequencer that reads parts out of strings (one token per sixteenth) and
plays them on instruments made of oscillators and noise, on the
AudioContext sound.js already builds. No audio files; nothing is created
before a gesture. Notes go down ahead on the audio clock, further ahead
when frames are slow, and a stall drops what it missed and stays on the
grid. Layers come in on bar lines; M mutes it and it keeps time.

sound.js now exposes the context it builds (and wake(), which the first
touch anywhere calls, so the title music can play before the first run).
Tests: a fake AudioContext, the sequencer (grid, stalls, slow frames,
mute, bar-line layering, sting hand-off, node cleanup) and the
composition itself (whole bars, real instruments, every cue main.js asks
for, a full run end to end).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GMNb8MBDZFeHduLGsa6wYH
@vercel

vercel Bot commented Sep 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
eggscape Ready Ready Preview Sep 22, 2026 7:31pm UTC

@h1ddenpr0cess20
h1ddenpr0cess20 merged commit 0fafef1 into main Sep 22, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — c6667f5e Deployed Sep 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants