Container specifications
Exact byte layouts, header bitfields, cluster seek tables, and registered MIME types for QAA1, QAAB, and QAAR.
QuaAudio defines three little-endian self-describing binary containers whose headers and magic bytes can be inspected without instantiating WebAssembly.
Magic headers & MIME types
| Container | Extension | 4-byte magic | MIME type | Role |
|---|---|---|---|---|
| Single-track stream | .qaa |
QAA1 (51 41 41 31) |
audio/x-quaaudio |
Standalone track with embedded cluster seek table |
| Multi-track solid bank | .qaab |
QAAB (51 41 41 42) |
application/x-quaaudio-bank |
Cross-track 3-stream solid chunks with trailing CRC-32 |
| Bank reference stub | — | QAAR (51 41 41 52) |
audio/x-quaaudio-ref |
Compact logical-path pointer targeting (bankPath, trackKey) |
1. .qaa track format (QAA1)
Fixed 48-byte header (QaaHeader)
| Byte range | Size | Type | Field | Description |
|---|---|---|---|---|
0..4 |
4 B | [u8; 4] |
magic |
ASCII "QAA1" |
4 |
1 B | u8 |
version |
Container version (1) |
5 |
1 B | u8 |
flags |
bit 0: 1 = LossyVbr, 0 = Lossless; bit 1: solid_clusters; bits 2..3: precision (0=Int8, 1=Int16, 2=Int24, 3=Float32) |
6 |
1 B | u8 |
channels |
Channel count (1..=8) |
7 |
1 B | u8 |
reserved |
Zero byte |
8..12 |
4 B | u32 LE |
sample_rate |
Sample rate in Hz (1..=768000) |
12..20 |
8 B | u64 LE |
total_samples |
Total frames per channel (including elided silence) |
20..28 |
8 B | u64 LE |
leading_silent_samples |
Exact leading zero-sample frames omitted |
28..36 |
8 B | u64 LE |
trailing_silent_samples |
Exact trailing zero-sample frames omitted |
36..40 |
4 B | u32 LE |
mode_param |
0 for lossless; target_ratio * 100 for lossy VBR (e.g., 1200 = 12.00x) |
40..42 |
2 B | u16 LE |
cluster_frames |
MDCT frames per cluster (default 64 = 65,536 samples) |
42..44 |
2 B | u16 LE |
reserved2 |
Zero-padded |
44..48 |
4 B | u32 LE |
audio_crc32 |
IEEE 802.3 CRC-32 over raw i32 interleaved PCM samples |
Cluster seek table & payloads
Immediately following the 48-byte header:
num_clusters(u32 LE, 4 bytes)num_clusters× 20-byteClusterEntryrecords:sample_offset(u64 LE)sample_count(u32 LE)compressed_size(u32 LE)flags(u32 LE, e.g., all-zero cluster0x01, M/S stereo0x02)
- Contiguous cluster payload blocks.
2. .qaab solid audio bank (QAAB)
| Region | Encoding | Contents |
|---|---|---|
| Header (8 B) | Fixed | QAAB (4 B) + version = 1 (1 B) + flags (1 B, bit 0 = 1 when shared 256-entry LBG codebook is present) + reserved (2 B) |
| LBG codebook (optional) | Varint length + solid_compress |
Flattened 256 × 32 byte spectral envelope codebook |
Directory (dir) |
Varint length + solid_compress |
Chunk stream sizes [s0, s1, s2, raw_rem], TSP-ordered track metadata, and per-cluster byte spans |
| Solid chunks | Concatenated stream blocks | For each chunk: comp_s0 (meta/ctrl), comp_s1 (quot), comp_s2 (micro), and raw_remainders |
| Trailer (4 B) | u32 LE |
IEEE 802.3 CRC-32 computed over every preceding byte |
3. QAAR pointer record (24 + bank_len + key_len bytes)
| Byte range | Size | Type | Field | Description |
|---|---|---|---|---|
0..4 |
4 B | [u8; 4] |
magic |
ASCII "QAAR" |
4 |
1 B | u8 |
version |
Version (1) |
5 |
1 B | u8 |
channels |
Channel count |
6 |
1 B | u8 |
precision |
Precision code (0..3) |
7 |
1 B | u8 |
reserved |
Zero byte |
8..12 |
4 B | u32 LE |
sample_rate |
Sample rate in Hz |
12..20 |
8 B | u64 LE |
total_samples |
Total frames per channel |
20..22 |
2 B | u16 LE |
bank_len |
UTF-8 byte length of bank_path |
22..24 |
2 B | u16 LE |
key_len |
UTF-8 byte length of track_key |
24.. |
bank_len + key_len |
UTF-8 | bank_path, track_key |
e.g., data/__quaaudio__/solid.qaab and default:audio/voice/001.ogg |