diff --git a/docs/superpowers/specs/2026-08-01-audio-conversion-design.md b/docs/superpowers/specs/2026-08-01-audio-conversion-design.md index 7c0eeb8..a24e601 100644 --- a/docs/superpowers/specs/2026-08-01-audio-conversion-design.md +++ b/docs/superpowers/specs/2026-08-01-audio-conversion-design.md @@ -80,9 +80,15 @@ Reuses the existing global `JOB_TIMEOUT_MS` (60s) in `src/worker.js` — no new ## `src/mime.js` -`OUTPUT_MIME_TYPES` additions: `mp3: 'audio/mpeg'`, `wav: 'audio/wav'`, `ogg: 'audio/ogg'`, `flac: 'audio/flac'`, `aac: 'audio/aac'`, `m4a: 'audio/mp4'`. +`OUTPUT_MIME_TYPES` additions: `mp3: 'audio/mpeg'`, `wav: 'audio/wav'`, `ogg: 'audio/ogg'`, `flac: 'audio/flac'`, `aac: 'audio/aac'`, `m4a: 'audio/x-m4a'` (confirmed against `file-type`'s own `ftyp`-box brand-major switch in `source/index.js`, which maps the `M4A` brand to `mime: 'audio/x-m4a'` — matching that here keeps the input-detected mime and the output-served mime consistent for round-trip m4a jobs). -`resolveInputFormat`/`normalizeFormat`: no changes needed. Confirmed by reading the installed `file-type` v22's `source/supported.js` — `mp3`, `wav`, `ogg`, `flac`, `aac`, `m4a` are all listed verbatim as detectable extensions, each matching our declared format string exactly (unlike archive's `tar.gz` → `gz` outer-layer aliasing, there's no alias mapping to add here). +`resolveInputFormat`/`normalizeFormat`: no changes needed. Confirmed by reading the installed `file-type` v22's `source/index.js` detection logic directly (not just the extension list in `source/supported.js`) for all six formats — each reports `ext` exactly matching our declared format string, so the existing identity-fallback comparison in `normalizeFormat` already works with no alias mapping to add (unlike archive's `tar.gz` → `gz` outer-layer aliasing): +- `wav`: `RIFF....WAVE` (bytes 0-3 `RIFF`, bytes 8-11 `WAVE`) +- `flac`: `fLaC` 4-byte magic +- `ogg`: `OggS` + 28 bytes ignored + an 8-byte packet-type field starting `\x01vorbis` +- `mp3`: MPEG frame sync — byte0 `0xFF`, byte1 masked `0xE0` (sync), then byte1 masked `0x06` == `0x02` (layer 3) +- `aac`: MPEG frame sync — byte0 `0xFF`, byte1 masked `0xE0` (sync), then byte1 masked `0x16` == `0x10` (ADTS, not layer 3) +- `m4a`: ISO-BMFF `ftyp` box — bytes 4-7 `ftyp`, bytes 8-11 major brand `M4A ` (space-padded) ## Registration wiring