| name | tonejs |
| description | Build browser audio and interactive music with Tone.js in TypeScript/JavaScript. Use when creating synths, samplers, players, effects, sequences, transport-synced events, Web Audio graphs, or any UI that makes sound with Tone.js. |
Tone.js
Tone.js is a Web Audio framework for interactive music in the browser.
When working with Tone.js, read the relevant local reference first. The files in references/ mirror the Tone.js README, examples, and TypeDoc API docs.
Critical rules
- Browser audio must start from a user gesture. Call
await Tone.start() in a click/key handler before playing sound.
- Dispose nodes you create (
synth.dispose(), effect.dispose(), etc.) when UI components unmount or sounds are no longer needed.
- Schedule with Tone's audio clock (
Tone.now(), Tone.getTransport() / Tone.Transport, triggerAttackRelease(..., time)) instead of setTimeout for musical timing.
- In new code, prefer
Tone.getTransport() over the deprecated global Tone.Transport; many official examples still use Tone.Transport.
- In TypeScript modules, prefer
import * as Tone from "tone"; examples from the Tone.js repo often use a global Tone object in browser HTML.
Minimal example
import * as Tone from "tone";
async function play() {
await Tone.start();
const synth = new Tone.Synth().toDestination();
synth.triggerAttackRelease("C4", "8n");
}
Start here
Common API references
Common examples
Task guide