Explorer’s Lab › Orbit Lounge › Build log
Build log
Generative space-age lounge music
Added original background music synthesised live in the browser: a bossa-nova lounge band (vibraphone, upright bass, brushes and a theremin) that varies as it plays, adapts to the game, plays stings for big moments and ducks under the sound effects.
Goal
Derek asked for a bit of background music, and chose music generated in code (option 1) over AI-generated audio files.
What was done
src/game/music.ts: an original 16-bar progression in the lounge/bossa idiom at 112 bpm, played by synthesised instruments:- vibraphone (sine plus a 4× bell partial, motor tremolo);
- upright bass (triangle and sine through a closing low-pass);
- brushes and rim clicks (filtered noise) and a soft kick;
- a theremin (one continuous voice with portamento and vibrato);
- a small generated room reverb.
- Scheduling: notes are scheduled slightly ahead on the audio clock, so timing is steady even when frames drop. The music resynchronises after a pause or a hidden tab.
- Variation: the comping rhythms, bass approach notes and theremin phrases are chosen freshly each time round. Theremin notes follow the chord tones and move smoothly from the previous note.
- Adaptive: three intensity levels driven by the game state, and stings for skill shots, orbits, the multiplier, extra balls and high scores.
- Mixing: every sound effect dips the music briefly. New Music volume and Background music on/off controls in Settings, saved with the other settings. The music pauses with the game.
What broke / found along the way
- The first site build failed: the log’s
summary:contained a colon, which broke the YAML front matter. Quoted it. - A menu bug from the previous session: opening Settings or High scores from the title screen and pressing Esc or Back showed the pause menu with no game running. A headless test of the new music settings caught it; Back and Esc now return to wherever the menu was opened from.
Verification
-
Typecheck clean; physics tests, build and
npm run checkpass. -
Offline render in headless Chrome (16 s per intensity, 50% music volume):
Peak Average (RMS) Title −16.3 dB −35.2 dB In play −15.1 dB −30.5 dB Heating up −14.9 dB −29.7 dB There’s no clipping, each intensity step is measurably denser, and the music sits well under the sound effects.
-
Not verified: how it actually sounds. An AI can measure levels and structure but can’t judge musical taste. That’s for Derek’s ears.
Notes
The progression and melodies are original; no existing tune was imitated.