-
Notifications
You must be signed in to change notification settings - Fork 1k
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)
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>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();
//...etcFor 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){
//...Here is an example using requirejs in its directory structure.
footer