No description
Find a file
2015-06-27 18:02:55 -04:00
build instrument examples 2015-06-15 22:36:20 -04:00
examples adding links to examples 2015-06-27 18:02:55 -04:00
gulp UMD comment 2015-06-13 22:31:43 -04:00
test update harmonicity api in test 2015-06-14 00:55:07 -04:00
Tone can set volume initially on instruments 2015-06-27 17:25:47 -04:00
utils switched from grunt to gulp 2015-05-23 18:14:03 -04:00
.gitignore updated gitignore to gulp 2015-06-07 12:58:47 -04:00
.jshintrc add AudioBuffer to jshint globals 2014-10-22 22:27:48 -04:00
bower.json include utils for bower 2014-12-10 12:45:33 +00:00
CHANGELOG.md harmonically as a signal value 2015-06-13 22:30:53 -04:00
LICENSE.md added license 2015-04-12 22:26:06 -04:00
package.json pointing the main to the right place 2015-03-09 10:48:03 -04:00
README.md new hello world 2015-06-26 01:22:16 -04:00

Tone.js

Tone.js is a Web Audio framework for creating interactive music in the browser. The architecture of Tone.js aims to be familiar to both musicians and audio programmers looking to create web-based audio applications. On the high-level, Tone offers common DAW (digital audio workstation) features like a global transport, prebuilt synths and effects, as well as presets for those synths and effects. For signal-processing programmers (coming from languages like Max/MSP), Tone provides a wealth of high performance, low latency building blocks and DSP modules to build your own synthesizers, effects, and complex control signals.

Examples

API

Demos

Using Tone.js? I'd love to hear it: yotammann@gmail.com

Installation

Tone can be installed in a few of ways:

  • Download Tone.js from Github - full | min
  • bower - bower install tone
  • npm - npm install tone

The fastest way to include Tone.js on your page is to use the CDN (not for production use, please):

<script type="text/javascript" src="http://cdn.tonejs.org/latest/Tone.min.js"></script>

It's always much safer to use a specific version rather than just "latest".

Full Installation Instruction

Hello World

//create one of Tone's built-in synthesizers and connect it to the master output
var synth = new Tone.SimpleSynth().toMaster();

//play a middle c for the duratino of an 8th note
synth.triggerAttackRelease("C4", "8n");

Tone.Transport

A unique feature of the library is the oscillator-based Transport which allows for application-wide synchronization of sources and signals. The Transport allows you to register callbacks at precise moments along the timeline which are invoked right before the event with the exact time of the event. Additionally, because the Transport is implemented with an oscillator, it is capable of elaborate tempo curves and automation.

Read more.

Time

In the Tone library, time can be described in a number of ways. Any method which takes a time as a parameter will accept the number in seconds as well as a tempo-relative form.

Read more about Tone.Time.

Sources

Aside from the 4 basic oscillator types (sine, square, triangle, sawtooth), Tone.js provides a few other sources such as a buffer player (Tone.Player), a noise generator, and two additional oscillator types (pwm, pulse).

Read more.

Instruments

Tone has a few prebuilt synthesizers.

Read more about how to use them.

Effects

Tone.js also has a few stereo and mono effects some of which also have their own presets.

Read more.

Components

Tone.js provides a number number of useful components for building synthesizers and effects.

Read more.

Signals

Like the underlying Web Audio API, Tone.js is built with audio-rate signal control over nearly everything. This is a powerful feature which allows for sample-accurate synchronization of multiple parameters with a single signal. Signals are built entirely without the ScriptProcessorNode so they do not introduce much latency and processing overhead. Instead, all signal math and logic let GainNodes and WaveShaperNodes do all of the work so that all processing is done in the underlying Assembly/C/C++ provided by the API. Signals are used extensively internally and are also useful for general DSP and control signal logic and transformations.

Read more about signals and [signal operators](https://github.com/TONEnoTONE/Tone.js/wiki/Signal Math).

AudioContext

Tone.js creates an AudioContext when it loads and shims it for maximum browser compatibility. The AudioContext can be found at Tone.context or from within any Object extending Tone as this.context.

Tone also let's you set your own AudioContext using Tone.setContext.

Performance

Tone.js uses very few ScriptProcessorNodes. Nearly all of the Tone Modules find a native Web Audio component workaround, making extensive use of the GainNode and WaveShaperNode especially, which enables Tone.js to work well on both desktop and mobile browsers. While the ScriptProcessorNode is extremely powerful, it introduces a lot of latency and the potential for glitches more than any other node.

References and Inspiration