AudioBits

Quick start

Install AudioBits from npm and play a procedural sound from a user gesture.

AudioBits API · 0.1.2 · Available on npm.

Install AudioBits from npm:

npm install audiobits

Play a confirmation

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 } from "audiobits";
import { confirmation } from "audiobits/recipes";

const audio = createAudio();
const sound = audio.sound(confirmation);
export async function play() {
  await audio.start();
  sound.play();
}

Bind play() to your button click and surface failures with void play().catch(showError). For hiding, SPA navigation, suspension and disposal, see Production lifecycle. The gallery never plays on load.

Next

Browser verification target: current Chromium. Other browsers and operating systems are unverified and deliberately deferred. The maintainer reported manual sound-quality acceptance for the current eight sounds on 2026-10-07; automated signals do not establish audible quality. Output devices and detailed listening coverage were not specified.

On this page