# Original adaptive score

Revision `music:v1` is an original runtime synthesis written for Starship Tactical. It uses no downloaded audio, samples, MIDI, or material from an existing franchise soundtrack. Nobody on the team can listen, so George's listening and approval remain pending; numeric checks are engineering evidence only.

## Plain-word cue designs

- **Quiet map and departure:** A low steady bed holds open space while a six-note line rises and settles above it.
- **Approach:** A soft low pulse joins when the encounter is entered.
- **Battle:** A measured upper pulse and brushed noise add urgency without becoming a march. It begins at the first emitted shot, not when a weapon is merely queued.
- **Red alert:** Two short warm notes mark a command ship crossing the 35% hull warning or a self-destruct being armed, then leave the score alone again.
- **Result:** Active rhythm releases and the quiet bed returns without a triumphal victory cue.

## Recipe and graph

`music-score.mjs` defines a six-note interval row `[0, 3, 7, 5, 10, 7]` above 146.83 Hz, four two-bar harmonic roots `[0, 5, 3, 7]`, and absolute-bar seeded variation. The score is 4/4 at 80 BPM, three seconds per bar and eight bars per 24-second harmonic cycle. The pad is the sustained bed; approach adds four low pulses per bar; battle keeps that pulse and adds four upper pulses plus two brushed-noise beats per bar. The rising density, register and percussion make each step measurable. These recipe values document what is played; they do not prove artistic originality or listening quality.

`battle-music.mjs` supplies the production Web Audio graph, event reducer and look-ahead scheduler. The music-only bus uses sine/triangle voices, a 4 kHz low-pass, 35 Hz high-pass and a WaveShaper soft clipper with a smooth knee from 0.20 to a 0.25 linear ceiling (−12.04 dBFS). It has no automatic makeup gain and does not change the Effects bus. Oscillator gain envelopes ramp at every edge. It schedules at most 150 ms ahead, wakes every 25 ms, caps voices at 24 and resynchronizes after a stall over 250 ms. Music has an independent lazy AudioContext, gain, mute, storage key and output; Effects and Music do not suspend each other.

The scheduler's variation is seeded from `music:v1` and the battle/sector seed passed at binding. It never reads or advances combat RNG. Music runs from the audio clock, so user speed and cinematic slow motion do not change pitch. Pausing, photo mode, hidden tabs, muting and battle replacement fade and release queued voices. The default is off until George listens at `../music.html`.

The Node offline renderer sums the production note plans and envelopes, generates the same deterministic noise buffer, applies matching 35 Hz and 4 kHz biquads, then uses the production WaveShaper curve at the selected Music volume. Its measured 3-second LUFS-like levels are pad **−27.37**, approach **−24.75**, battle **−22.88**, and sting **−21.82**. Their targets are −28 to −23, −25 to −21, −23 to −19, and −22 to −18 respectively. A stored Firefox export measured −19.29 LUFS-like for pad under the former compressor, 8.20 dB above the raw score; the compressor's automatic makeup gain was removed. Claude must rerun the browser export to confirm the replacement graph, especially combined Effects plus Music peaks.

## Diagnostics

Open `http://127.0.0.1:8787/library/audio/music.html` after `npm start`. That page imports the production score and graph, can play cues and transitions, and exports stereo float PCM from `OfflineAudioContext` at 44.1 and 48 kHz. Run `node scripts/check-music-metrics.mjs --input /path/to/exported-files --output /tmp/starship-music-metrics.json`. The report includes loudness in the weapon toolkit's LUFS-like scale, RMS, peak and estimated intersample peak, DC, spectrum bands, seams, plan hashes and release lengths. It is not a listening test, certified mastering or owner approval.
