Introduction and quick start
Choose a starting point, install the AudioBits runtime, and play your first procedural sound.
AudioBits API · 0.7.0 · Available on npm.
AudioBits generates procedural browser audio from recipes. Use the catalog to hear and adjust sounds and interactive experiences, then use these guides to bring them into your application.
The audiobits npm package is the audio runtime: it interprets recipe data and
creates browser audio. The shadcn registry installs editable recipes and
sound controllers into your project. Demo renderers stay in the showcase. Each
item declares audiobits as an npm dependency, so installed source uses the same runtime as an original sound you
write yourself.
Choose a starting point
Runtime
Install audiobits from npm, then write or integrate an original sound with
the quick start below.
Catalog & Editable Source
Hear ready-made sounds in the showcases. Install or copy only their recipes or sound controllers, then connect your existing application controls.
AI Agents
Install the official AudioBits Skill to help coding agents create sounds and wire them into your application.
Browse the live catalog for sounds to adapt, or see the runtime reference for public APIs. The agent guide also links to optional MCP tooling for complex workflows.
Install the runtime
For an original sound, install AudioBits directly with your project's package manager. This installs the runtime, not catalog source or the agent Skill.
npm install audiobitsPlay a tone
Start audio from a user gesture
Create the engine and definition without allocating browser audio. Call play()
directly from your button's click handler and report rejected promises to the user.
Retry a failed start with a fresh Play gesture.
import { createAudio, defineSound } from "audiobits";
const recipe = defineSound({
schemaVersion: 1,
kind: "one-shot",
duration: 0.15,
layers: [
{
id: "tone",
source: { type: "oscillator", waveform: "sine", frequency: 660 },
gainDb: -18,
envelope: { attack: 0.004, decay: 0.08, sustain: 0.1, release: 0.04 },
},
],
});
const audio = createAudio();
const sound = audio.sound(recipe);
let request = 0;
export async function play() {
const token = ++request;
await audio.start();
if (token !== request) return;
sound.play();
}
export function stop() {
request++;
audio.stopAll({ tails: "cut" });
}
export async function dispose() {
stop();
await audio.dispose();
}Own the host lifecycle
Bind play() to your button click and surface failures with
void play().catch(showError). For hiding, SPA navigation, suspension and disposal,
bind stop() to Stop and await dispose() when removing the host.
See Production lifecycle. The catalog never plays on load.
Next
- Listen and adjust catalog sounds and complete interactive experiences.
- Catalog and editable source: installation, customization, and integration.
- Official Skill and agent workflows: integration and original audio creation.
- Recipes: validated JSON and supported fields.
- Playback and lifecycle: sound versus voice, Stop, and teardown.
- Parameters: controls, smoothing, and seeded replay.
- Buses and routing: named routes, gain, and mute.
- Native interop: caller-owned analyser taps.
- API reference: public exports and limits.
Browser verification target: current Chromium. Other browsers and operating systems are unverified and deliberately deferred.