# Music Credits

The four OpenGameArt works below are offered under [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/). Their individual work pages were checked on 2026-10-20 and each links its CC0 license. Attribution is retained for traceability, not as a CC0 requirement. Redline Circuit is an original project composition, not a third-party CC0 work.

| Shipped file | Work | Author | Source | License |
| --- | --- | --- | --- | --- |
| menu.m4a, menu.mp3 | Menu Theme | tamesu | https://opengameart.org/content/menu-theme | CC0 1.0 |
| redline-circuit.m4a, redline-circuit.mp3 | Redline Circuit | poke2d team | Project-original score and synthesis, `code/chipMusic.ts`, rendered as `code/battle.wav` in the supplied BGM source bundle | Original |
| battle-2.m4a, battle-2.mp3 | Battle 2 | Aureolus_Omicron | https://opengameart.org/content/15-melodic-rpg-chiptunes | CC0 1.0 |
| victory.m4a, victory.mp3 | Victory sting | congusbongus | https://opengameart.org/content/victory-sting | CC0 1.0 |
| defeat.m4a, defeat.mp3 | Total Fail | congusbongus | https://opengameart.org/content/total-fail | CC0 1.0 |

## Original Inputs

Paths are relative to the supplied BGM source directory (the repository owner's `.tmp/v09/bgm`), not runtime dependencies. Originals are not redistributed as part of the playable build.

| Work | Original input | SHA-256 |
| --- | --- | --- |
| Menu Theme | `web/oga-tamesu-menu-theme/menu_title.mp3` | `549d434895431d964dc4c1ca70a36ef24d56172630a06ad48472974cff92386a` |
| Redline Circuit | `code/battle.wav` | `39f41f0ed7cfd2b7a7ccb324d621b9f64a3543cea944aef79aa5d9826c580c9d` |
| Battle 2 | `web/oga-aureolus-15-melodic-rpg-chiptunes/rpgchip14_battle_2.ogg` | `e4f7eecfe7e22acfc8602065b9fe48b8605214f9acfc628d3c51bbaa18787939` |
| Victory sting | `web/oga-congusbongus-victory-sting/victory sting.ogg` | `07fb9a06bc3ba23af2199c57db40b84dd977de55323d994282a4789bf5d0b7c6` |
| Total Fail | `web/oga-congusbongus-total-fail/total fail.ogg` | `47fd63173c55096ab2bca5584ba05ad6bde186c36fd35608ee83154111244ee3` |

## Reproduce Processing

Requires locally available FFmpeg/ffprobe (processed with FFmpeg 7.1.1). From the BGM worktree:

```sh
node scripts/process-bgm.mjs /Volumes/WD1T/outsea/poke2d-web/.tmp/v09/bgm
```

The script creates the five AAC-LC M4A files and `loops.json` here; intermediate PCM and measurements stay in `.tmp/v091-bgm/process/`. It uses two-pass `loudnorm` targeting -16 LUFS and -1.5 dBTP before AAC encoding, then measures the encoded output and fails if true peak exceeds -1 dBTP, loudness differs by more than 1 LU, a file exceeds 2,000,000 bytes, or actual stream bitrate falls outside 96-128 kbps. Output is 44.1 kHz stereo, nominal 112 kbps AAC, with fast-start metadata. The lower encoding target leaves headroom for AAC's average-bitrate overshoot on chip transients. No new runtime or package dependency is required.

- Menu Theme: trim decoded audio at 65.525 seconds, removing the approximately 147ms silent tail (MP3 container duration includes padding). Apply a 50ms linear tail/head crossfade, rotated into the loop end. Final PCM loop: 65.475011 seconds. This raises the source's approximately -28.4 LUFS to the level below.
- Battle 2: trim at the accompanying MIDI's final event, 106.660676 seconds, rather than the OGG's 107.4119-second export tail. This is a timing reference, not proof of an inaudible tail; a 50ms tail/head crossfade blends the join. Final PCM loop: 106.610680 seconds.
- Redline Circuit: retain the original 32-bar loop (50.526327 seconds), already rendered to a whole loop with its short notated rest; no extra overlap or tail trim.
- Victory sting and Total Fail: normalize/encode without loop editing; play once.
- Crossfades overlap 50ms and therefore shorten the two third-party loops by 50ms. `loops.json` records processed PCM endpoints so Web Audio loops exclude any AAC encoder padding. Playback uses native buffer looping, not per-frame JavaScript synthesis.

| Shipped file | Bytes | Stream kbps | Integrated LUFS | True peak dBTP |
| --- | ---: | ---: | ---: | ---: |
| menu.m4a | 996,199 | 120.199 | -16.05 | -1.77 |
| redline-circuit.m4a | 793,662 | 124.099 | -16.11 | -4.32 |
| battle-2.m4a | 1,557,150 | 115.382 | -16.14 | -3.17 |
| victory.m4a | 105,964 | 107.546 | -16.03 | -1.66 |
| defeat.m4a | 34,702 | 110.538 | -16.09 | -3.33 |

## MP3 Compatibility Copies

Added on 2026-10-21 for browsers without AAC decoding. The original AAC files and `loops.json` are unchanged. Each MP3 uses the same original input SHA-256 above, trim/crossfade, processed PCM and two-pass loudness normalization as its AAC counterpart; it is not transcoded from the lossy AAC file. No new composition, recording, sample or license is introduced.

To reproduce, use the PCM preparation and two-pass `loudnorm` filter in `scripts/process-bgm.mjs`, retaining its measured normalization parameters. For each normalized PCM input, replace only the output extension with `.mp3` and the AAC output encoder arguments with:

```sh
-ar 44100 -c:a libmp3lame -b:a 112k -write_xing 1
```

Processed with the same FFmpeg 7.1.1. Output is MPEG-1 Layer III, 44.1 kHz stereo, 112 kbps CBR, with Xing/LAME gapless metadata. Loop playback still uses the existing PCM endpoints. The MP3s passed the same encoded loudness, true-peak, bitrate and file-size limits described above; real Chrome and Chromium decode tests also check non-silent PCM and loop sample counts.

| Shipped file | Bytes | Stream kbps | Integrated LUFS | True peak dBTP |
| --- | ---: | ---: | ---: | ---: |
| menu.mp3 | 917,620 | 112 | -16.45 | -1.94 |
| redline-circuit.mp3 | 708,432 | 112 | -16.51 | -4.30 |
| battle-2.mp3 | 1,493,620 | 112 | -16.47 | -3.64 |
| victory.mp3 | 107,563 | 112 | -16.38 | -1.95 |
| defeat.mp3 | 34,420 | 112 | -16.45 | -4.42 |

Playback first tries AAC, then the same song in MP3 only after `EncodingError` or `NotSupportedError`. A format that cannot decode is not retried during that page session. Other playback failures permit one subsequent gesture retry, and failed downloads are capped at two requests per file per page. If neither format can decode, music remains silent without blocking navigation; reloading starts a new attempt. The last selected-track failure is available through the player's `inspect()` diagnostics.

Loop editing, decoding and signal measurements are technical checks, not a claim of human listening approval or real-device Safari testing. CC0 is the uploaders' stated license, not a guarantee of authorship or broader Pokemon/IP rights. The original score contains newly written synthesis and no imported samples; no global melody fingerprint comparison has been performed.
