tonejs/tone.js — explained in plain English
Analysis updated 2026-06-24 · repo last pushed 2026-05-20
Build a step sequencer or drum machine that runs entirely in the browser.
Add interactive synths and samplers to a web game or art installation.
Prototype a generative music piece with looped patterns and tempo automation.
Add musical sound effects triggered by user input on a webpage.
| tonejs/tone.js | jimp-dev/jimp | mksglu/context-mode | |
|---|---|---|---|
| Stars | 14,609 | 14,605 | 14,627 |
| Language | TypeScript | TypeScript | TypeScript |
| Last pushed | 2026-05-20 | 2026-04-07 | 2026-05-21 |
| Maintenance | Maintained | Maintained | Maintained |
| Setup difficulty | easy | easy | moderate |
| Complexity | 3/5 | 2/5 | 4/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Browsers block audio until a user gesture, so you must call Tone.start inside a click or keydown handler before any sound plays.
Tone.js is a JavaScript library for making interactive music in a web browser. It sits on top of the Web Audio API and tries to feel familiar to two groups: musicians who think in terms of bars and beats, and audio programmers who care about sample-accurate timing. The README says the library offers digital audio workstation style features such as a global transport for scheduling, along with prebuilt synthesizers and effects, plus lower-level building blocks for making your own. You can install it from npm with npm install tone and import it in JavaScript with import * as Tone from tone, or you can drop a script tag from unpkg.com directly into an HTML page. The simplest hello world is two lines: create a new Tone.Synth, attach it to the speakers with toDestination, then call triggerAttackRelease with a note name like C4 and a duration like an eighth note. The library has its own time language. Methods that expect a time can take a number of seconds, or a string like 4n for a quarter note, 8t for an eighth note triplet, or 1m for one measure. There are matching methods triggerAttack and triggerRelease for note on and note off, and Tone.now returns the current AudioContext time. Browsers will not play any audio until the user interacts with the page, so the README stresses calling await Tone.start inside a click or keydown handler before scheduling anything. For arrangement, Tone.getTransport returns a clock you can start, stop, loop, and tempo-shift on the fly. The example builds two monophonic synths, wraps them in Tone.Loop callbacks at quarter note intervals offset by an eighth, starts the transport, and ramps the BPM up to 800 over ten seconds. Because JavaScript callbacks are not precisely timed, the loop passes the exact event time into the callback, and the README is firm that you should use that value when triggering notes. The instruments section lists Tone.FMSynth, Tone.AMSynth, and Tone.NoiseSynth, all monophonic, and Tone.PolySynth which wraps a monophonic synth to allow chords. For real recordings, Tone.Player loads and plays back an audio file, and Tone.Sampler combines several pitch-labeled audio files into a polyphonic instrument that fills in missing notes by pitch shifting. Tone.loaded returns a promise that resolves when all audio buffers are ready. Sources can also be routed through one or more effects before reaching the speakers. The full README is longer than what was shown.
JavaScript library for making interactive music in the browser on top of the Web Audio API, with a transport clock, prebuilt synths, samplers and effects.
Mainly TypeScript. The stack also includes JavaScript, TypeScript, Web Audio API.
Maintained — commit in last 6 months (last push 2026-05-20).
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.