AudioBits is currently tested in Chromium-based browsers. Other browsers are not yet verified.
Synth lead
A sustained pitched lead with an authored onset scoop, independent live bend and brightness.
Control position · Bend 50%
Synth lead: stopped
Audio: idle
Sound controls
Add to project
npx shadcn@latest add joacod/audiobits/synth-leadAdds 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 { synthLead } from "./sounds/recipes/synth-lead/recipe";
const audio = createAudio();
const sound = audio.sound(synthLead);
let request = 0;
let voice: ReturnType<typeof sound.play> | undefined;
// 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;
voice?.stop();
voice = sound.play({ parameters: {"bend":0,"brightness":0.5,"frequency":440,"velocity":0.8} });
}
// Connect application state to these live parameters.
export function update(values: { "bend": number; "brightness": number }) {
voice?.set(values);
}
// Release with the recipe's natural tail.
export function release() {
request++;
voice?.stop();
voice = undefined;
}
export function stop() {
request++;
audio.stopAll({ tails: "cut" });
voice = undefined;
}
// 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.
{
"effects": [
{
"filter": "lowpass",
"frequency": {
"control": "brightness",
"range": [
600,
8000
],
"scale": "exponential"
},
"q": 1.2,
"type": "filter"
}
],
"kind": "sustained",
"layers": [
{
"envelope": {
"attack": 0.008,
"decay": 0.12,
"release": 0.16,
"sustain": 0.75
},
"gainDb": {
"control": "velocity",
"range": [
-30,
-12
],
"scale": "linear"
},
"id": "lead",
"source": {
"detune": {
"control": "bend",
"range": [
-200,
200
],
"scale": "linear"
},
"frequency": {
"curve": "exponential",
"points": [
[
0,
{
"control": "frequency",
"range": [
107.25,
858
],
"scale": "linear"
}
],
[
0.05,
{
"control": "frequency",
"range": [
110,
880
],
"scale": "linear"
}
]
]
},
"type": "oscillator",
"waveform": "sawtooth"
}
},
{
"envelope": {
"attack": 0.008,
"decay": 0.12,
"release": 0.16,
"sustain": 0.7
},
"gainDb": {
"control": "velocity",
"range": [
-36,
-22
],
"scale": "linear"
},
"id": "body",
"source": {
"detune": {
"control": "bend",
"range": [
-200,
200
],
"scale": "linear"
},
"frequency": {
"control": "frequency",
"range": [
55,
440
],
"scale": "linear"
},
"type": "oscillator",
"waveform": "triangle"
}
}
],
"parameters": {
"bend": {
"default": 0,
"max": 200,
"min": -200,
"mode": "live",
"smoothing": 0.04
},
"brightness": {
"default": 0.5,
"max": 1,
"min": 0,
"mode": "live",
"smoothing": 0.04
},
"frequency": {
"default": 440,
"max": 880,
"min": 110,
"mode": "play"
},
"velocity": {
"default": 0.8,
"max": 1,
"min": 0,
"mode": "play"
}
},
"schemaVersion": 1
}