AudioBits is currently tested in Chromium-based browsers. Other browsers are not yet verified.
Rock drum kit
Kick, snare, closed/open hats and crash for procedural rock grooves.
Control position · Velocity 80%
Rock drum kit: ready
Audio: idle
Sound controls
Add to project
npx shadcn@latest add joacod/audiobits/rock-drum-kitAdds 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 { rockKick } from "./sounds/recipes/rock-drum-kit/recipe";
const audio = createAudio();
const sound = audio.sound(rockKick);
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({ parameters: {"velocity":0.8}, seed: 42 });
}
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.2,
"kind": "one-shot",
"layers": [
{
"envelope": {
"attack": 0,
"decay": 0.17,
"release": 0.07,
"sustain": 0.2
},
"gainDb": {
"control": "velocity",
"range": [
-17,
-5
],
"scale": "linear"
},
"id": "body",
"source": {
"frequency": {
"curve": "exponential",
"points": [
[
0,
{
"random": [
118,
130
]
}
],
[
0.025,
67
],
[
0.16,
48
]
]
},
"type": "oscillator",
"waveform": "sine"
}
},
{
"envelope": {
"attack": 0,
"decay": 0.035,
"release": 0.02,
"sustain": 0
},
"gainDb": {
"control": "velocity",
"range": [
-24,
-13
],
"scale": "linear"
},
"id": "punch",
"source": {
"frequency": {
"curve": "exponential",
"points": [
[
0,
340
],
[
0.025,
120
]
]
},
"type": "oscillator",
"waveform": "triangle"
}
},
{
"effects": [
{
"filter": "lowpass",
"frequency": 420,
"q": 0.8,
"type": "filter"
}
],
"envelope": {
"attack": 0,
"decay": 0.1,
"release": 0.04,
"sustain": 0
},
"gainDb": {
"control": "velocity",
"range": [
-36,
-26
],
"scale": "linear"
},
"id": "grit",
"source": {
"frequency": {
"curve": "exponential",
"points": [
[
0,
130
],
[
0.06,
52
]
]
},
"type": "oscillator",
"waveform": "square"
}
},
{
"effects": [
{
"filter": "highpass",
"frequency": 2800,
"q": 0.7,
"type": "filter"
}
],
"envelope": {
"attack": 0,
"decay": 0.012,
"release": 0.01,
"sustain": 0
},
"gainDb": {
"control": "velocity",
"range": [
-34,
-22
],
"scale": "linear"
},
"id": "click",
"source": {
"color": "white",
"type": "noise"
}
}
],
"parameters": {
"velocity": {
"default": 0.8,
"max": 1,
"min": 0,
"mode": "play"
}
},
"schemaVersion": 1
}