Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7.4 KiB
7.4 KiB
@suaveplan/audio-engine-browser - Browser-tier TimelineAdapter implementation: Web Audio rendering, AudioWorklet hosting, and AudioFxPlugin createAudioNode integration for the universal TimelineEngine.
Browser-tier TimelineAdapter implementation for the @suaveplan/audio-*
family. Hosts Web Audio rendering, AudioWorklet loading, and the
AudioFxPlugin.createAudioNode() integration so a universal
TimelineEngine drives browser audio output through a single
timeline.setAdapter(new BrowserTimelineAdapter(...)) call.
The package is browser-tier: it may reference AudioContext,
OfflineAudioContext, AudioWorklet, and HTMLAudioElement, but every
such reference goes through an injectable seam (the context option or
the standardized-audio-context shim) so the package is testable under
happy-dom without a real browser.
Documentation tree
- adapter-introspection —
adapter-introspectionis a small support module that holds theBrowserTimelineAdapteroperations that would otherwi… - adapter-lifecycle —
adapter-lifecycleis the small helper module that owns theBrowserTimelineAdapter's context resolution and the `thr… - adapter-track-ops —
adapter-track-opspacks every track-scoped mutation that theBrowserTimelineAdapterexposes — adding, removing, upd… - browser-adapter —
BrowserTimelineAdapteris the browser-tier rendering engine of the@suaveplan/audio-*family. It implements the `Ti… - bus-orchestrator —
BusOrchestratoris the per-adapter owner of the project-level sidechain bus graph. It wraps a single `DefaultBusRegis… - fx-host —
fx-hostis the small switch-board that picks the best available render path for anAudioFxPluginand returns a sing… - mixer-state —
mixer-stateextracts the pure mixer / ambient bookkeeping out of theBrowserTimelineAdapterclass so the adapter fi… - standardized-audio-context-bridge —
standardized-audio-context-bridgeis the dynamic-import wrapper forstandardized-audio-context'sAudioContextcon… - track-subgraph — This module is the small, focused factory that materialises the documented per-track Web Audio chain inside `BrowserTim…
- decode —
decode(source, opts?)decodes browser-tier audio bytes into a fully populatedAudioDocumentfrom `@suaveplan/audio-…- decode —
decode(source, opts?)decodes browser-tier audio bytes into a fully populatedAudioDocumentfrom `@suaveplan/audio-…
- decode —
- error-codes — This module declares the structured error-code registry for
@suaveplan/audio-engine-browser. Every fault path inside…- error-codes — This module declares the structured error-code registry for
@suaveplan/audio-engine-browser. Every fault path inside…
- error-codes — This module declares the structured error-code registry for
- fallback —
Html5AudioFallbackis the graceful-degradation path for browsers and runtimes without the Web Audio API. It implement…- html5-fallback —
Html5AudioFallbackis the graceful-degradation path for browsers and runtimes without the Web Audio API. It implement…
- html5-fallback —
- graph —
WebAudioGraphis the thin id-keyed registry that sits betweenBrowserTimelineAdapterand aBaseAudioContext. It e…- web-audio-graph —
WebAudioGraphis the thin id-keyed registry that sits betweenBrowserTimelineAdapterand aBaseAudioContext. It e…
- web-audio-graph —
- offline —
renderOfflineis the bridge to non-realtime export. It wires aBrowserTimelineAdapterto anOfflineAudioContext,…- offline-render —
renderOfflineis the bridge to non-realtime export. It wires aBrowserTimelineAdapterto anOfflineAudioContext,…
- offline-render —
- worklet —
AudioWorkletManageris the gatekeeper for everythingAudioWorklet- related insideBrowserTimelineAdapter. It vali…- worklet-manager —
AudioWorkletManageris the gatekeeper for everythingAudioWorklet- related insideBrowserTimelineAdapter. It vali…
- worklet-manager —
Install
bun add @suaveplan/audio-engine-browser
Quick start
import { BrowserTimelineAdapter } from "@suaveplan/audio-engine-browser";
import { TimelineEngine } from "@suaveplan/audio-timeline";
const adapter = new BrowserTimelineAdapter({ lookAhead: 0.1, ppqn: 960 });
await adapter.init();
const timeline = new TimelineEngine();
timeline.setAdapter(adapter);
timeline.setTracks(myTracks);
timeline.play();
// Later
adapter.dispose();
Modules
adapter/browser-adapter—BrowserTimelineAdapterimplementingTimelineAdapter.adapter/adapter-lifecycle— context resolution and assertion helpers.adapter/adapter-track-ops— track-scoped mutations.adapter/adapter-introspection— FX hosting and bus declarations.adapter/track-subgraph— fixed-shape per-track Web Audio chain factory.adapter/mixer-state— solo/ambient/PDC.adapter/bus-orchestrator— cycle-checked project-level bus registry.adapter/fx-host— render-path picker forAudioFxPlugin.graph/web-audio-graph— id-keyed Web Audio node graph with snapshot/restore.worklet/worklet-manager—AudioWorklethost with allow-list and abort support.fallback/html5-fallback— graceful-degradation<audio>-backedTimelineAdapter.offline/offline-render—renderOffline(timeline, duration, sampleRate)non-realtime export.error-codes—BrowserAudioErrorregistry.
Features
- Universal
TimelineAdaptercontract — swap engines without conditional branching. - Fixed-shape per-track subgraph matching DAW topology.
- DAW solo semantics, master / per-track volume / mute / pan, loop region, tempo.
- Per-track
PluginChainfrom@suaveplan/audio-fx-plugin-basewith shared project-levelBusRegistry. - Bus cycle detection (
AUDIO_ENGINE_BROWSER.BUS_CYCLE_DETECTED) and topological process ordering. - Three FX render paths: native
AudioNode,AudioWorklet,ScriptProcessorNodefallback. Html5AudioFallbackfor environments without the Web Audio API.- Offline export via
OfflineAudioContext. - Typed
BrowserAudioErrorfamily with seven codes. - Real OTel: tracer (
engine_browser.init,engine_browser.set_tracks,engine_browser.offline_render), counter (audio_engine_browser_nodes_created_total), histogram (audio_engine_browser_offline_render_duration_ms). - 100% test coverage; tests run under
happy-domwith an injected context shim.