AudioBits is currently tested in Chromium-based browsers. Other browsers are not yet verified.
Confirmation
A soft upward chime for a completed action.
Confirmation: ready
Audio: idle
Add to project
npx shadcn@latest add joacod/audiobits/confirmationAdds editable source and the audiobits runtime dependency. Installation guide
Installs the catalog defaults. The usage below reflects your current settings and applied edits.
Use this sound
Use in src/integration.ts. Call play() from a user gesture and handle activation errors. Connect updates to application state; stop on cancellation or hiding, and dispose on removal.
import { createAudio } from "audiobits";
import { confirmation } from "./sounds/recipes/confirmation/recipe";
const audio = createAudio();
const sound = audio.sound(confirmation);
let request = 0;
// Use in src/integration.ts. Call play() from a user gesture; handle errors.
export async function play() {
const token = ++request;
await audio.start();
if (token !== request) return;
sound.play();
}
export function stop() {
request++;
audio.stopAll({ tails: "cut" });
}
// Call on navigation/unmount.
export async function dispose() {
stop();
sound.dispose();
await audio.dispose();
}
Production lifecycleCustomize or inspect
Recipe
Apply valid JSON edits to hear and copy them. Copy Recipe returns the applied definition; the Add command installs catalog defaults.
{
"duration": 0.18,
"effects": [
{
"filter": "lowpass",
"frequency": 3200,
"q": 0.7,
"type": "filter"
}
],
"kind": "one-shot",
"layers": [
{
"envelope": {
"attack": 0.004,
"decay": 0.12,
"release": 0.04,
"sustain": 0.08
},
"gainDb": -14,
"id": "body",
"source": {
"frequency": {
"curve": "exponential",
"points": [
[
0,
520
],
[
0.05,
660
]
]
},
"type": "oscillator",
"waveform": "sine"
}
},
{
"envelope": {
"attack": 0.008,
"decay": 0.1,
"release": 0.05,
"sustain": 0.03
},
"gainDb": -26,
"id": "air",
"source": {
"frequency": 1320,
"type": "oscillator",
"waveform": "sine"
}
}
],
"schemaVersion": 1
}