use case · basics · multi-scale codebook anatomy · WebGPU fp32 / WASM fp32 · ~80.3 MB

3-Tier Multi-Scale Token Inspector

Every 2,048 audio samples (~85.3 ms at 24 kHz), SNAC emits exactly 7 integers in [0, 4095]: 1 Coarse token (12 Hz), 2 Mid tokens (24 Hz), and 4 Fine tokens (48 Hz). Inspect all 3 tracks on Canvas 2D, check codebook utilization and Shannon entropy, and prove the codec works by exporting or editing raw integer .json token packets and decoding them back into audio.

1 · Model

2 · Encode audio & inspect the 1 : 2 : 4 token hierarchy

Prepare SNAC 24kHz above to inspect its multi-scale codebook tokens.

Clip duration—
Total tokens—
Packed payload—
Realized bitrate—
Encode latency—
Per-tier codebook utilization, Shannon entropy (max 12.00 bits), and realized bitrate
Tier Hop (samples) Rate (Hz) Tokens Unique / 4096 Utilization Entropy (bits) Bitrate (bps)
Encode a clip above to inspect per-tier codebook statistics.

Parent → Child Frame Alignment (first 6 coarse frames · 85.3 ms each)

Individual 1 : 2 : 4 frame trees appear after encoding.

3 · Portable Integer Token Packet (.json) — Export, Edit & Decode

Everything SNAC needs to reconstruct the audio is the JSON packet of integers below. Export it, tweak values in [0, 4095], or load a saved .json packet and decode it live through SNAC's neural decoder.

Encode a clip first, then decode the JSON packet directly.

Decoded Audio from JSON Token Packet

No packet decoded yet.

4 · Show the code

Show multi-scale bitrate & entropy accounting (snac-core.mjs)
Show SNAC Web Worker encodeAudio & decodeCodes (worker.js)