-
Notifications
You must be signed in to change notification settings - Fork 998
Installation
There are a few ways to download and install Tone.js.
- Github - full | min
- Bower - bower install tone
- npm - npm install tone
- cdn - CDN (not for production use, please)
RequireJS is the recommended way to use Tone.js but it can also be used just as well without it.
Tone.js can be used like any other script or library by dropping the into the
of your page. A global calledTone
will be added to the window
.
<script type="text/javascript" src="path/to/Tone.js"></script>
or from the Tone's CDN
<script type="text/javascript" src="http://cdn.tonejs.org/latest/Tone.min.js"></script>
To use any of the instrument and effect presets, be sure to grab the Tone.Presets build which is not included in the default build.
RequireJS is a JavaScript module loader which Tone.js uses internally for dependency management. It is a powerful tool for development and deploying. Using r.js (RequireJS's optimizer) can bring package size down significantly since it will only include the modules used in your code.
You can use the built file with Require like any other external script.
require(["Tone"], function(Tone){
var synth = new Tone.MonoSynth();
//...etc
For the full RequireJS experience, maintain the directory structure of the library and reference all modules from the root directory "Tone". Add a path to the root directory. This will require familiarizing yourself with the directory structure.
require.config({
baseUrl: "./base",
paths: {
"Tone" : "path/to/Tone.js/Tone"
}
});
require(["Tone/core/Transport"], function(Transport){
//...
footer