Skip to content

Live decode demo (WASM)

iclforge::ac3's decoder, compiled to WebAssembly, decoding an E-AC-3 elementary stream entirely in your browser — no server-side decode, no upload. This is the same C++ decode path forge decode uses, running as WASM instead of a native binary.

Open the demo in its own tab

What this demonstrates

The decode and the audio both come from iclforge::ac3's own decode path, running as WASM. The per-channel bed energy drives the two speaker rings (solid = ear-level, dashed = ceiling — ported from the desktop GUI's SoundfieldView.qml). For a stream carrying Atmos objects, each object's decoded position (OAMD, iclforge#168) moves in the top-down/elevation room view, and a "solo object" control plays that object's own JOC-reconstructed audio (iclforge#169) — its isolated waveform, decoded from the bitstream, rather than a re-panned approximation of its slice of the bed. Drop in your own .ac3, .ec3 or .eac3 file to decode something other than the bundled fixture; a plain (non-Atmos) stream simply has zero objects.

The page decodes AC-3 and E-AC-3 only. The AC-4 decoder is a separate WebAssembly module, iclforge_wasm_ac4, built in the same CI job; it has no demo page yet. See WebAssembly → AC-4 module.

Sing along (karaoke streams)

Drop in a karaoke stream (Annex C: a guide melody where a centre would be, and the vocals where the surrounds would be; the repository's examples/karaoke/ has two) and the page gains a Microphone card. It shows how close your pitch is to the tune while you sing:

  • The tune is the guide melody's channel as coded, read by the library's pitch tracker, compiled into this page's module. It is drawn as a ribbon of notes, with your voice as a line over it.
  • The microphone is off until you turn it on. The browser asks you first; nothing is recorded and nothing leaves the page. Closing it ends the tracks.
  • The score is shown only when you say you are wearing headphones, because through open speakers the microphone hears the backing as well as you and the score reads as nearly perfect for no singing. The browser's own echo cancellation is asked for either way.
  • It counts how much of the tune's time your pitch was within a semitone of it, in any octave. It hears pitch only, not timing, words or feeling.
  • Each line gets a small mark when you have sung it: three dots and a percentage, or "not sung" where you did not. A line the tune has no notes in has none.
  • A delay and a timing slider are for the rest: the microphone's own latency (the browser's figure where it gives one) and where you want to move your timing.

The tracker and scorer are libs/pitch, the library Hearth's microphone is built on, so a number here and a number there mean the same thing. WebAssembly → Microphone in the decode demo has how it is put together and what has and has not been checked.

Third-party notices

The module this page loads carries more than iclforge::ac3. It statically links {fmt} (cmake/Fmt.cmake pins 12.2.0, and the committed iclforge_decode.wasm carries fmt::v12::format_error's mangled RTTI name), which is distributed under the MIT licence, whose text is in this repository at notices/licences/MIT-fmt.txt. The module also carries the Emscripten runtime and the C++ standard library that toolchain supplies, each under its own licence.

Crucible's packages carry a generated NOTICES.txt for this reason; the servable demo directory does not yet, so this section stands in for one.

Source and how it's built

Source: apps/demos/wasm/ — see WebAssembly for the build/toolchain details and what's reused vs. new. CI rebuilds this embed fresh from source on every deploy to main; see Release / CI.

This page is a consumer of iclforge-wasm-decoder (source: bindings/js/) rather than a parallel implementation of its own: the decode, the §7.8 fold and (in the demo's realtime section further down) the AudioWorklet playback pipeline all come from that package.

iclforge-wasm-decoder has never been published to npm. The publish job in .github/workflows/npm.yml is restricted to a manual workflow_dispatch, so pushing a release tag packs the tarball as a CI artefact and stops there; there is no release of it to install. No date is set for that changing, and WebAssembly → Publishing has the two things that must be cleared first.

So what a reader can do today is one of two things. Use the demo above, which runs the decoder in your browser with nothing to install. Or build the package from source: clone the repository, then cd bindings/js && npm ci && npm run build — the same install and build CI runs in bindings/js/ on every pull request that touches it — and point your project at the resulting bindings/js/dist/. The package ships no compiled .wasm of its own: decodeFile() and PushDecoder take the instantiated Embind module as their first argument, and IclForgeDecoderNode takes a wasmGlueUrl pointing at the Emscripten glue, so you also need the module built from apps/demos/wasm/; WebAssembly covers that build. The README is the package's own API documentation. The package exists at all because a browser cannot be relied on to decode EC-3: Chrome reports a decoder error when an EC-3 track turns up in an MPD, in a report that has been open since 2023.