Audio Engine for the Web. Wwise-grade routing, sprite loading, sidechain ducking — in a tiny ESM package.
pnpm add zvukimport { createEngine } from 'zvuk';
const engine = createEngine({
buses: {
music: { level: 0.8 },
sfx: { level: 1.0 },
},
master: { headroom: -3 },
});
await engine.unlock(); // call from a user gesture
await engine.loadSound('coin', '/sfx/coin.wav', { bus: 'sfx' });
const v = engine.sound('coin').play({ volume: { jitter: 0.05 } });
await v.fade({ to: 0, ms: 800 });
engine.bus('music').fadeTo(0.1, 800);zvuk/
├── src/ the zvuk package source
├── test/ vitest suite
├── docs/ Astro docs site (deploys to zvuk.dev)
└── tsup.config.ts single-file ESM build
- The root package is
zvuk. It's what npm publishes. - The docs site lives in
docs/and deploys independently. Concept pages embed live React-island demos that drive the real engine.
pnpm install
pnpm test
pnpm typecheck
pnpm build
pnpm docs:devWhat each script does:
pnpm test— Vitest, happy-dom + Web Audio mock.pnpm typecheck—tsc --noEmitacrosssrc/andtest/.pnpm build— tsup bundlesdist/index.js+dist/index.d.ts.pnpm docs:dev— Astro dev server at http://localhost:4321. Reads the package source directly via thesrc/index.tsexports — no priorpnpm buildneeded.
The package's exports field resolves to src/index.ts for workspace
consumers. publishConfig overrides it to dist/... at publish time so
npm consumers get the compiled artifact.
Releases are managed by Changesets:
pnpm changeset # describe your change (patch / minor / major)
git add .changeset/*.md && git commit -m "feat: describe it"
git push # PR + merge to mainMIT