upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/audio.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/audio.md')
-rw-r--r--docs/audio.md10
1 files changed, 9 insertions, 1 deletions
diff --git a/docs/audio.md b/docs/audio.md
index dcf8fee7a..6799be83a 100644
--- a/docs/audio.md
+++ b/docs/audio.md
@@ -99,7 +99,13 @@ then 16 bytes per channel:
99At the `0x55` data offset, each chunk starts with a 24-byte record per channel. The record's `+4` word is the 99At the `0x55` data offset, each chunk starts with a 24-byte record per channel. The record's `+4` word is the
100channel's subblock count and `+8` is a repeated-prefix sample count to skip. The channel data are its run of 100channel's subblock count and `+8` is a repeated-prefix sample count to skip. The channel data are its run of
1012048-byte subblocks after the 2048-aligned header. The skipped samples repeat the previous chunk's tail, so the 1012048-byte subblocks after the 2048-aligned header. The skipped samples repeat the previous chunk's tail, so the
102exporter drops whole packets until the count is consumed. Each Opus channel becomes one mono Ogg Opus file. 102exporter drops whole packets until the count is consumed. Each descriptor channel becomes one Ogg Opus file.
103
104The descriptor's `channels` field is the number of channel groups, not necessarily the packet channel count.
105An Opus packet's TOC stereo bit (`packet[0] & 0x04`) gives the real count, and the descriptor's `samples` field
106counts interleaved samples across those packet channels. The exporter therefore writes a stereo Ogg with
107`OpusHead channels=2` and `samples / 2` as the end granule when the packets are stereo; mono groups keep their
108count unchanged. Reading `samples` as a frame count produces a file that reports twice its real duration.
103 109
104## What the exporters write 110## What the exporters write
105 111
@@ -170,6 +176,8 @@ the audio itself is not. See the ground rules in [design.md](design.md#ground-ru
170- 300 random Opus streams decode with ffmpeg with no errors; their lengths match the declared sample counts. 176- 300 random Opus streams decode with ffmpeg with no errors; their lengths match the declared sample counts.
171- All 1,818 XMA2 streams decode after `rpf9dump xma`. 177- All 1,818 XMA2 streams decode after `rpf9dump xma`.
172- A 4-channel streamed-music bank gives four 42.0 s mono channels with real levels and no decoder errors. 178- A 4-channel streamed-music bank gives four 42.0 s mono channels with real levels and no decoder errors.
179- A 1-channel streamed-music descriptor can carry stereo Opus packets; it exports as one stereo Ogg with the
180 interleaved sample count halved, and a 3-channel descriptor with stereo packets exports three stereo Oggs.
173- All exported WAVs decode. Codec 2 values are stored as-is, so a float WAV can exceed ±1. 181- All exported WAVs decode. Codec 2 values are stored as-is, so a float WAV can exceed ±1.
174 182
175The tools export the streams and channels as stored. They do not reconstruct runtime mixing, looping, ducking or 183The tools export the streams and channels as stored. They do not reconstruct runtime mixing, looping, ducking or