Repository navigation
Give the Matrix a soundtrack, and the pod a heartbeat - #5
Merged
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
How it works
There are no audio files.
src/ui/music.jsis 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 thatsound.jsalready builds.src/ui/soundtrack.jsis this game's composition.music.jsis the same file in all four egg games.sound.jsnow exposes its context and awake()method. The first touch or key press anywhere wakes the audio, so the title music can play before the first run.Mmutes the music, and it keeps time while muted.Testing
npm test: 98 pass, including new tests.test/music.test.jsruns 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.jschecks the composition: whole bars, real instruments, every cuemain.jsasks for, and a full title → run → over run on the real parts.npm run lintis clean, andnpm run buildsucceeds.🤖 Generated with Claude Code
https://claude.ai/code/session_01GMNb8MBDZFeHduLGsa6wYH
Generated by Claude Code