CH·46 Engine audio
verified 2026-08-01

@nerima-games/mc-audio active

nerima-games vunknown added 2026-08-01 verified 2026-08-01

[Use when]

You need a DOM-free WebAudio engine module for a browser game with SFX cue registry, BGM state machine, and caption events that fire before any audio gate check, including when audio is muted or blocked.

Engines
S Standalone * Engine-agnostic
License

MIT

Pricing

Free

Last verified

2026-08-01

Added

2026-08-01

Category

Engine audio

about

mc-audio is a TypeScript package that handles the audio layer for a browser game: it manages a sound cue registry, a BGM state machine, volume category arithmetic, and a caption event stream. The core invariant is that caption events fire before audio gate checks — captions are emitted even when audio is muted, blocked by autoplay policy, or when no backend exists at all. This makes the system correct for deaf and muted players by design.

The package deliberately excludes DOM from its TypeScript lib config, forcing all WebAudio-specific behavior behind an AudioBackendPort interface. This means the entire domain — cue planning, volume math, BGM transitions, caption streams — can be tested with Vitest without jsdom or AudioContext. The WebAudio adapter is a separate concern written last, not first.

Dependencies are restricted to Effect and an internal kernel package, enforced mechanically by a dependency whitelist script. The package is a sink in the architecture: it receives calls from gameplay and UI layers but never imports from the simulation layer. As of the current state, the WebAudio adapter is not yet implemented, the cue roster is provisional, and there is no build/publish pipeline.