whatisgithub

What is tone.js?

tonejs/tone.js — explained in plain English

Analysis updated 2026-06-24 · repo last pushed 2026-05-20

14,609TypeScriptAudience · developerComplexity · 3/5MaintainedSetup · easy

In one sentence

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.

Mindmap

mindmap
  root((Tone.js))
    Inputs
      Note names
      Time strings like 4n
      Audio files
    Outputs
      Web Audio playback
      Scheduled events
    Use Cases
      Browser music apps
      Interactive instruments
      Generative audio
    Tech Stack
      JavaScript
      TypeScript
      Web Audio API
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a step sequencer or drum machine that runs entirely in the browser.

USE CASE 2

Add interactive synths and samplers to a web game or art installation.

USE CASE 3

Prototype a generative music piece with looped patterns and tempo automation.

USE CASE 4

Add musical sound effects triggered by user input on a webpage.

What is it built with?

JavaScriptTypeScriptWeb Audio API

How does it compare?

tonejs/tone.jsjimp-dev/jimpmksglu/context-mode
Stars14,60914,60514,627
LanguageTypeScriptTypeScriptTypeScript
Last pushed2026-05-202026-04-072026-05-21
MaintenanceMaintainedMaintainedMaintained
Setup difficultyeasyeasymoderate
Complexity3/52/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Browsers block audio until a user gesture, so you must call Tone.start inside a click or keydown handler before any sound plays.

So what is it?

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.

Copy-paste prompts

Prompt 1
Show me a Tone.js hello world that plays a C major chord on a PolySynth when I click a button, including the await Tone.start handler.
Prompt 2
Build a 4-step Tone.js drum loop using Tone.Player samples and Tone.getTransport, with a play and stop button in plain HTML.
Prompt 3
Convert this MIDI-style note array into Tone.js Tone.Loop callbacks scheduled on the transport: <paste notes here>.
Prompt 4
Wire a Tone.Sampler with three pitch-labeled wav files, route it through a Tone.Reverb, and trigger it from a keyboard input.
Prompt 5
Explain how Tone.js time strings like 4n, 8t and 1m map to seconds at a given BPM, with a small code example.

Frequently asked questions

What is tone.js?

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.

What language is tone.js written in?

Mainly TypeScript. The stack also includes JavaScript, TypeScript, Web Audio API.

Is tone.js actively maintained?

Maintained — commit in last 6 months (last push 2026-05-20).

How hard is tone.js to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is tone.js for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.