# Beatemup original soundtrack

## District and boss themes — revision 4

Each district and boss has its own theme, with different composed melodies and rhythms. Tokyo retains its E-minor street score. New York has a new syncopated D-minor melody; Shenzhen uses a clipped C-minor electronic motif. Gundam's F-sharp-minor rhythmic theme, Johnny Five's D-minor punk riff and the Sentinel's descending B-minor phrases distinguish the boss fights. Pitched instruments remain at 28% gain so drums dominate. The six existing percussion arrangements are preserved; the three additional cues have new kick patterns. The victory cue stays in minor.

| Cue | Track | Tempo | Length |
| --- | --- | --- | --- |
| Title | Night Raid | 148 BPM | 0:39 |
| Tokyo | Neon Lockdown | 168 BPM | 1:31 |
| New York | Steel Pursuit | 160 BPM | 1:36 |
| Shenzhen | Circuit Siege | 172 BPM | 1:29 |
| Unicorn Gundam | Unicorn Overdrive | 180 BPM | 1:04 |
| Punk Johnny Five | Punk Tread Riot | 184 BPM | 1:03 |
| Sentinel | Eight Arms of Ruin | 188 BPM | 1:01 |
| Victory | Sector Secured | 152 BPM | 0:13 |
| Defeat | One More Credit | 82 BPM | 0:23 |

Each district has 64 bars across eight sections; each boss has 48 bars across six sections. Short motifs alternate with answers and breakdowns. Muted guitar doubles bass attacks. Defeat remains a sparse, drumless regrouping cue. Boss themes continue through the collapse animation until the district congratulations cue.

The existing FM instrument timbres and drum sounds are retained. Melody notes have fixed tuning, and the bass uses roots and fifths. All notes and instrument samples are original; no game recordings or ROM samples are used.

## Playback and optimization

The game plays pre-rendered 32 kHz stereo, 128 kbit/s MP3 files. Synthesis runs only during development. The nine cues total approximately nine minutes; exact byte sizes and levels are in [soundtrack-manifest.json](soundtrack-manifest.json). Loop tails are folded into the beginning; finite ending cues fade out. Masters target RMS 0.14 with peak headroom, and encoded audio is checked separately.

Music downloads only after sound is enabled, as each cue is needed. Only the current decoded track remains cached after a short crossfade. Pause, mute, hidden-page handling and authority changes stop playback; resume retains position. Browser asset URLs use revision 4 to avoid replaying cached older mixes.

## Review and rebuilding

[Listen to the exact game mixes](soundtrack.html).

- [music-score.js](music-score.js): notes, harmony and arrangements.
- [music-synth.js](music-synth.js): original FM/PCM instrument bank.
- [render-soundtrack.cjs](render-soundtrack.cjs): offline Web Audio rendering and local ffmpeg encoding.
- [audio.js](audio.js): runtime cue playback.
- Production MP3s: `src/main/immutable/app/beatemup/music/`.
- Development PCM masters: `tmp/beatemup/music/`.

Run `node src/main/apps/app/beatemup/render-soundtrack.cjs` to render all nine cues using the existing local Chrome, Playwright and ffmpeg installations.

## Verification scope

`music-balance.test.cjs` compares the six existing percussion arrangements with their previous versions and checks that every pitched note belongs to its current chord. `music-balance.browser.test.cjs` renders separate drum and pitched-instrument stems for the second eight-bar section of each combat cue. Pitched/drum RMS ratios are 0.274 (Tokyo), 0.271 (New York), 0.265 (Shenzhen), 0.232 (Gundam), 0.240 (Johnny Five) and 0.233 (Sentinel), approximately 11–13 dB below the drums in those passages. `district-music.test.cjs` checks six different melodies after normalizing their pitches, distinct kick patterns and district/boss/ending selection.

`music.test.cjs` checks score structure, combat tempo, absence of bright ornament voices, distinct mixes, current rendered notes, loop joins and headroom. `music.browser.test.cjs` checks actual decoded MP3 duration, stereo content, levels and loop joins, plus cue changes, mute, pause, resume and finite endings. ES5 compatibility is checked by `assets.test.cjs`.

These are composition and signal checks. This session cannot audition the sound; subjective listening remains available on the soundtrack page.
# Attract and intro song

The user-supplied **Take It Back Tonight — Michael Gardiner** plays during the lobby demo and opening comic. It loops independently of the demo scene changes and continues into the comic without restarting. Fighting crossfades to the selected district theme. Sound must be enabled; mute and visibility behavior follow the existing audio controls.

Production file: `music/intro.mp3`. Original 192 kbps stereo MP3 audio is stream-copied without re-encoding. Removing embedded artwork and metadata reduced the supplied 4,557,312-byte file to 2,441,969 bytes. Duration: approximately 101.68 seconds. `intro-music.json` preserves its metadata when the original chiptune score is regenerated. This supplied song is separate from the nine generated score cues documented below.
