Encode the menu theme as AAC
8.3 MB of WAV down to 768 KB, on a file that downloads on every page load before the player has decided to play anything. loopBed takes the full filename now, because the beds are a mix of .wav and .m4a — fadeBed's key has to match it exactly, extension included, or a duck silently no-ops. It also takes an explicit loopEnd, and the theme passes 48. AAC pads its last packet, so Chrome decodes this 48.000s master to a 48.0174s buffer: 17ms of silence spliced in at every seam, once a loop, on the title screen. Trimming the seam is what keeps the loop seamless. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c567ff68a6
commit
cf3498c049
5 files changed
+33
-11
No files matched your search
+15
-3
@@ -454,9 +454,21 @@ death summary is the end menu, and the zombie bed ducks out as it comes in. Two
|
||||
bed's gain at 0. Without it, a multi-megabyte file ducked mid-fetch comes up at full level several
|
||||
seconds later, over the match.
|
||||
|
||||
`background-music.wav` is 8.3 MB and now downloads on every page load. Converting it to m4a (as the
|
||||
umpire lines already are) would cut that ~10x; `loopBed` hardcodes `.wav`, so that is a two-line
|
||||
change if it ever matters.
|
||||
**The theme is AAC** (`background-music.m4a`, 768 KB — the WAV was 8.3 MB, and this one downloads on
|
||||
every page load before the player has decided to play). `loopBed` takes the FULL filename now,
|
||||
because the beds are a mix of `.wav` and `.m4a`; `fadeBed`'s key must match it exactly, extension
|
||||
included, or a duck silently no-ops.
|
||||
|
||||
**A compressed loop needs an explicit `loopEnd`.** AAC pads the final packet, so Chrome decodes this
|
||||
48.000 s master to a 48.0174 s buffer — 17 ms of silence spliced in at every seam, once a loop, on
|
||||
the title screen. `menuMusic` passes `48`. Re-encode the file and re-measure:
|
||||
`fetch(f).then(r=>r.arrayBuffer()).then(a=>new AudioContext().decodeAudioData(a)).then(b=>b.duration)`.
|
||||
`zombie-mode.wav` (5.9 MB) is the other candidate for this treatment, and it loads mid-match rather
|
||||
than up front, so it matters less.
|
||||
|
||||
Measuring which audio files actually loaded: `performance.getEntriesByType('resource')` is USELESS
|
||||
here — the ~200 sprite PNGs blow past the 250-entry resource-timing buffer and every later fetch is
|
||||
silently dropped from it. Read the network log instead. That cost a wrong "the bed never loaded".
|
||||
|
||||
## Session log: the serve is the gesture (2026-08-01)
|
||||
|
||||
|
||||
Reference in new issue
Block a user