A Python library for music theory, composition, and audio sketching, letting you analyze chords and scales and render playable MIDI and sound from code.
Tonejs/Tone.js
A Web Audio framework for building interactive music and synthesizers in the browser, with DAW-style transport scheduling.
- Stars
- 14,890
- Forks
- 1,087
- Open issues
- 50
- Last commit
- 7 days ago
What is it?
Tone.js is a JavaScript framework for making interactive music in the browser on top of the Web Audio API. It offers DAW-like features such as a global Transport for synchronizing and scheduling events, along with prebuilt synths, samplers and effects that can be routed together.
The library also provides lower-level building blocks for creating custom synthesizers, effects and control signals. Timing is expressed in musical units like "8n" or "1m" as well as seconds, and callbacks receive sample-accurate times for scheduling. Audio files can be loaded with Player and Sampler, which pitch-shifts samples to fill gaps between notes.
Tone.js is installable via npm and can also be loaded directly from unpkg in an HTML page. Browsers require a user gesture before audio plays, so applications call Tone.start() from a click or keydown handler.
Key features
- 01Global Transport for synchronizing and scheduling events, similar to a DAW arrangement view.
- 02Prebuilt monophonic and polyphonic synths, including FMSynth, AMSynth, NoiseSynth and PolySynth.
- 03Sampler and Player for loading audio files and pitching samples across notes.
- 04Built-in effects that can be connected serially or in parallel.
- 05Audio-rate Signal parameters with ramps and automation curves.
- 06Musical time notation such as "4n" and "8t" alongside seconds.
Use cases
- Building browser-based music sequencers or drum machines.
- Creating interactive generative music or audio visualizations on a web page.
- Prototyping synthesizers and effects with Web Audio.
- Adding sample-based instruments to a web game or music education app.
Quick start
- 1
Install Tone.js from npm
npm install tone - 2
Import Tone.js into your project
import * as Tone from "tone"; - 3
Create a synth, connect it to the speakers, and play a note after a user click (call Tone.start() first)
Things to know
- Browsers block audio until a user action, so Tone.start() must be called from a user event.
Topics
FAQ
- What is Tone.js?
- A Web Audio framework for building interactive music and synthesizers in the browser, with DAW-style transport scheduling. Tone.js is a JavaScript framework for making interactive music in the browser on top of the Web Audio API. It offers DAW-like features such as a global Transport for synchronizing and scheduling events, along with prebuilt synths, samplers and effects that can be routed together.
- Is Tone.js free to use? What license does it have?
- Tone.js is open source under the MIT license. Check the license terms before using it in commercial products.
- Is Tone.js still maintained?
- Actively maintained. The last commit to Tone.js was on Nov 1, 2026.
- What can I use Tone.js for?
- Building browser-based music sequencers or drum machines. Creating interactive generative music or audio visualizations on a web page. Prototyping synthesizers and effects with Web Audio. Adding sample-based instruments to a web game or music education app.
- How do I install Tone.js?
- Install Tone.js from npm: npm install tone Import Tone.js into your project: import * as Tone from "tone"; Create a synth, connect it to the speakers, and play a note after a user click (call Tone.start() first)
- Where can I get Tone.js?
- The source code and installation instructions are on GitHub: https://github.com/Tonejs/Tone.js
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A web-based digital audio workstation (DAW) for making music in the browser, with no sign-up and no tracking.
A browser-based 3D boat journey down a Japanese river valley, rendered live with three.js across four seasons and any hour of the day.
A high-precision web audio player that keeps music in sync across multiple browser devices, with spatial audio controls.
A Microsoft-led beginner course teaching Generative AI with JavaScript through a time-travel story and a companion character chat app.
A curated collection of ready-to-run Docker Compose samples that show how to wire together common services for local development.