diff --git a/Tone.js b/Tone.js index a728c905..4d427ce3 100644 --- a/Tone.js +++ b/Tone.js @@ -95,6 +95,7 @@ define("Tone/core/Tone", [], function(){ /** * Tone is the baseclass of all ToneNodes + * * From Tone, children inherit timing and math which is used throughout Tone.js * * @constructor @@ -128,12 +129,15 @@ define("Tone/core/Tone", [], function(){ /** * A static pointer to the audio context * @type {AudioContext} + * @static */ Tone.prototype.context = Tone.context; /** * the default buffer size * @type {number} + * @static + * @const */ Tone.prototype.bufferSize = 2048; @@ -312,7 +316,7 @@ define("Tone/core/Tone", [], function(){ * @param {Tone.Time} time * @param {number=} now if passed in, this number will be * used for all 'now' relative timings - * @return {number} + * @return {number} seconds in the same timescale as the AudioContext */ Tone.prototype.toSeconds = function(time, now){ now = this.defaultArg(now, this.now()); @@ -1945,6 +1949,8 @@ function(Tone){ * 8t = eighth-note triplet * * @return {boolean} + * @method isNotation + * @lends Tone.prototype.isNotation */ Tone.prototype.isNotation = (function(){ var notationFormat = new RegExp(/[0-9]+[mnt]$/i); @@ -1959,6 +1965,8 @@ function(Tone){ * 1:2:0 = 1 measure + two quarter notes + 0 sixteenth notes * * @return {boolean} + * + * @lends Tone.prototype.isTransportTime */ Tone.prototype.isTransportTime = (function(){ var transportTimeFormat = new RegExp(/^\d+(\.\d+)?:\d+(\.\d+)?(:\d+(\.\d+)?)?$/); @@ -1973,6 +1981,8 @@ function(Tone){ * * @param {number} freq * @return {boolean} + * + * @lends Tone.prototype.isFrequency */ Tone.prototype.isFrequency = (function(){ var freqFormat = new RegExp(/[0-9]+hz$/i); @@ -1983,11 +1993,13 @@ function(Tone){ /** + * * convert notation format strings to seconds * @param {string} notation * @param {number=} bpm * @param {number=} timeSignature - * @return {number} + * @return {number} + * */ Tone.prototype.notationToSeconds = function(notation, bpm, timeSignature){ bpm = this.defaultArg(bpm, Tone.Transport.getBpm()); @@ -2013,13 +2025,15 @@ function(Tone){ /** * convert transportTime into seconds - * i.e.: - * 4:2:3 == 4 measures + 2 quarters + 3 sixteenths * + * ie: 4:2:3 == 4 measures + 2 quarters + 3 sixteenths + * * @param {string} transportTime * @param {number=} bpm * @param {number=} timeSignature * @return {number} seconds + * + * @lends Tone.prototype.transportTimeToSeconds */ Tone.prototype.transportTimeToSeconds = function(transportTime, bpm, timeSignature){ bpm = this.defaultArg(bpm, Tone.Transport.getBpm()); @@ -2045,11 +2059,15 @@ function(Tone){ /** * Convert seconds to the closest transportTime in the form * measures:quarters:sixteenths - * + * + * @method toTransportTime + * * @param {Tone.Time} seconds * @param {number=} bpm * @param {number=} timeSignature - * @return {string} + * @return {string} + * + * @lends Tone.prototype.toTransportTime */ Tone.prototype.toTransportTime = function(time, bpm, timeSignature){ var seconds = this.toSeconds(time, bpm, timeSignature); @@ -2085,7 +2103,8 @@ function(Tone){ * * unlike the method which it overrides, this takes into account * transporttime and musical notation - * + * + * @override * @param {Tone.Time} time * @param {number=} now if passed in, this number will be * used for all 'now' relative timings @@ -4023,10 +4042,10 @@ define('Tone/source/Player',["Tone/core/Tone", "Tone/source/Source"], function(T * @param {string=} url if a url is passed in, it will be loaded * and invoke the callback if it also passed * in. - * @param {function(Tone.Player)=} cb callback to be invoked + * @param {function(Tone.Player)=} onload callback to be invoked * once the url is loaded */ - Tone.Player = function(url, cb){ + Tone.Player = function(url, onload){ Tone.Source.call(this); /** @@ -4073,7 +4092,7 @@ define('Tone/source/Player',["Tone/core/Tone", "Tone/source/Source"], function(T //if there is a url, load it. if (url){ - this.load(url, cb); + this.load(url, onload); } }; diff --git a/doc/Add.js.html b/doc/Add.js.html deleted file mode 100644 index 4e5f7baf..00000000 --- a/doc/Add.js.html +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - Tone.js Source: signal/Add.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: signal/Add.js

- -
-
-
define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
-
-	/**
-	 *  Adds a value to an incoming signal
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number} value
-	 */
-	Tone.Add = function(value){
-		Tone.call(this);
-
-		/**
-		 *  @private
-		 *  @type {Tone}
-		 */
-		this._value = new Tone.Signal(value);
-
-		//connections
-		this.chain(this._value, this.input, this.output);
-	};
-
-	Tone.extend(Tone.Add);
-
-	/**
-	 *  set the constant
-	 *  
-	 *  @param {number} value 
-	 */
-	Tone.Add.prototype.setValue = function(value){
-		this._value.setValue(value);
-	}; 
-
-	/**
-	 *  dispose method
-	 */
-	Tone.Add.prototype.dispose = function(){
-		this._value.dispose();
-		this.input.disconnect();
-		this.output.disconnect();
-		this._value = null;
-		this.input = null;
-		this.output = null;
-	}; 
-
-	return Tone.Add;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/AutoPanner.js.html b/doc/AutoPanner.js.html deleted file mode 100644 index 2607c88f..00000000 --- a/doc/AutoPanner.js.html +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - Tone.js Source: effect/AutoPanner.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: effect/AutoPanner.js

- -
-
-
define(["Tone/core/Tone", "Tone/effect/Effect", "Tone/component/LFO", "Tone/component/Panner"], function(Tone){
-
-	/**
-	 *  AutoPanner is a Tone.Panner with an LFO connected to the pan amount
-	 *
-	 *  @constructor
-	 *  @extends {Tone.Effect}
-	 *  @param { number= } rate (optional) rate in HZ of the left-right pan
-	 *  @param { number= } amount (optional) of the pan (0 - 1)
-	 */
-	Tone.AutoPanner = function(rate, amount){
-		Tone.Effect.call(this);
-
-		/**
-		 *  the lfo which drives the panning
-		 *  @type {Tone.LFO}
-		 */
-		this.lfo = new Tone.LFO(rate, 0, 1);
-
-		/**
-		 *  the panner node which does the panning
-		 *  @type {Tone.Panner}
-		 */
-		this.panner = new Tone.Panner();
-
-		//connections
-		this.connectEffect(this.panner);
-		this.lfo.connect(this.panner.pan);
-		//default dry value
-		this.setDry(this.defaultArg(amount, 1));
-	};
-
-	//extend Effect
-	Tone.extend(Tone.AutoPanner, Tone.Effect);
-	
-	/**
-	 * Start the panner
-	 * 
-	 * @param {Tone.Time=} Time the panner begins.
-	 */
-	Tone.AutoPanner.prototype.start = function(time){
-		this.lfo.start(time);
-	};
-
-	/**
-	 * Stop the panner
-	 * 
-	 * @param {Tone.Time=} time the panner stops.
-	 */
-	Tone.AutoPanner.prototype.stop = function(time){
-		this.lfo.stop(time);
-	};
-
-	/**
-	 * Set the type of oscillator attached to the AutoPanner.
-	 * 
-	 * @param {string} type of oscillator the panner is attached to (sine|sawtooth|triangle|square)
-	 */
-	Tone.AutoPanner.prototype.setType = function(type){
-		this.lfo.setType(type);
-	};
-
-	/**
-	 * Set frequency of the oscillator attached to the AutoPanner.
-	 * 
-	 * @param {number|string} rate in HZ of the oscillator's frequency.
-	 */
-	Tone.AutoPanner.prototype.setFrequency = function(rate){
-		this.lfo.setFrequency(rate);
-	};
-
-	/**
-	 *  pointer to the parent's dipose method
-	 */
-	Tone.AutoPanner.prototype._effectDispose = Tone.Effect.prototype.dispose;
-
-	/**
-	 *  clean up
-	 */
-	Tone.AutoPanner.prototype.dispose = function(){
-		this._effectDispose();
-		this.lfo.dispose();
-		this.panner.dispose();
-		this.lfo = null;
-		this.panner = null;
-	};
-
-	return Tone.AutoPanner;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/BitCrusher.js.html b/doc/BitCrusher.js.html deleted file mode 100644 index 2603c540..00000000 --- a/doc/BitCrusher.js.html +++ /dev/null @@ -1,362 +0,0 @@ - - - - - - Tone.js Source: signal/BitCrusher.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: signal/BitCrusher.js

- -
-
-
define(["Tone/core/Tone"], function(Tone){
-
-	/**
-	 *  downsample incoming signal
-	 *  inspiration from https://github.com/jaz303/bitcrusher/blob/master/index.js
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number=} bits   
-	 *  @param {number=} frequency 
-	 */
-	Tone.BitCrusher = function(bits, frequency){
-
-		Tone.call(this);
-
-		/** 
-		 * @private 
-		 * @type {number}
-		 */
-		this._bits = this.defaultArg(bits, 8);
-		
-		/** 
-		 * @private 
-		 * @type {number}
-		 */
-		this._frequency = this.defaultArg(frequency, 0.5);
-		
-		/** 
-		 * @private 
-		 * @type {number}
-		 */
-		this._step = 2 * Math.pow(0.5, this._bits);
-		
-		/** 
-		 * @private 
-		 * @type {number}
-		 */
-		this._invStep = 1/this._step;
-		
-		/** 
-		 * @private 
-		 * @type {number}
-		 */
-		this._phasor = 0;
-		
-		/** 
-		 * @private 
-		 * @type {number}
-		 */
-		this._last = 0;
-		
-		/** 
-		 * @private 
-		 * @type {ScriptProcessorNode}
-		 */
-		this._crusher = this.context.createScriptProcessor(this.bufferSize, 1, 1);
-		this._crusher.onaudioprocess = this._audioprocess.bind(this);
-
-		//connect it up
-		this.chain(this.input, this._crusher, this.output);
-	};
-
-	Tone.extend(Tone.BitCrusher);
-
-	/**
-	 *  @private
-	 *  @param  {AudioProcessingEvent} event
-	 */
-	Tone.BitCrusher.prototype._audioprocess = function(event){
-		//cache the values used in the loop
-		var phasor = this._phasor;
-		var freq = this._frequency;
-		var invStep = this._invStep;
-		var last = this._last;
-		var step = this._step;
-		var input = event.inputBuffer.getChannelData(0);
-		var output = event.outputBuffer.getChannelData(0);
-		for (var i = 0, len = output.length; i < len; i++) {
-			phasor += freq;
-		    if (phasor >= 1) {
-		        phasor -= 1;
-		        last = step * ((input[i] * invStep) | 0 + 0.5);
-		    }
-		    output[i] = last;
-		}
-		//set the values for the next loop
-		this._phasor = phasor;
-		this._last = last;
-	};
-
-	/**
-	 *  set the bit rate
-	 *  
-	 *  @param {number} bits 
-	 */
-	Tone.BitCrusher.prototype.setBits = function(bits){
-		this._bits = bits;
-		this._step = 2 * Math.pow(0.5, this._bits);
-		this._invStep = 1/this._step;
-	};
-
-	/**
-	 *  set the frequency
-	 *  @param {number} freq 
-	 */
-	Tone.BitCrusher.prototype.setFrequency = function(freq){
-		this._frequency = freq;
-	};
-
-	/**
-	 *  clean up
-	 */
-	Tone.BitCrusher.prototype.dispose = function(){
-		this.input.disconnect();
-		this.output.disconnect();
-		this._crusher.disconnect();
-		this.input = null;
-		this.output = null;
-		this._crusher = null;
-	}; 
-
-	return Tone.BitCrusher;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Bus.js.html b/doc/Bus.js.html deleted file mode 100644 index 655f94ae..00000000 --- a/doc/Bus.js.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - Tone.js Source: core/Bus.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: core/Bus.js

- -
-
-
define(["Tone/core/Tone"], function(Tone){
-
-	/**
-	 *  buses are another way of routing audio
-	 *
-	 *  augments Tone.prototype to include send and recieve
-	 */
-
-	 /**
-	  *  All of the routes
-	  *  
-	  *  @type {Object}
-	  */
-	var Buses = {};
-
-	/**
-	 *  send signal to a channel name
-	 *
-	 *  @param  {string} channelName 
-	 *  @param  {number} amount      
-	 *  @return {GainNode}             
-	 */
-	Tone.prototype.send = function(channelName, amount){
-		if (!Buses.hasOwnProperty(channelName)){
-			Buses[channelName] = this.context.createGain();
-		}
-		var sendKnob = this.context.createGain();
-		sendKnob.gain.value = this.defaultArg(amount, 1);
-		this.chain(this.output, sendKnob, Buses[channelName]);
-		return sendKnob;		
-	};
-
-	/**
-	 *  recieve the input from the desired channelName to the input gain of 'this' node.
-	 *
-	 *  @param  {string} channelName 
-	 */
-	Tone.prototype.receive = function(channelName){
-		if (!Buses.hasOwnProperty(channelName)){
-			Buses[channelName] = this.context.createGain();	
-		}
-		Buses[channelName].connect(this.input);
-	};
-
-	Tone.Buses = Buses;
-
-	return Buses;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/DryWet.js.html b/doc/DryWet.js.html deleted file mode 100644 index 71f5b6b3..00000000 --- a/doc/DryWet.js.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - Tone.js Source: component/DryWet.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: component/DryWet.js

- -
-
-
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Scale"], function(Tone){
-
-	/**
-	 * DRY/WET KNOB
-	 * 
-	 * equal power fading control values:
-	 * 	0 = 100% dry  -    0% wet
-	 * 	1 =   0% dry  -  100% wet
-	 *
-	 * @constructor
-	 * @param {number=} initialDry
-	 */		
-	Tone.DryWet = function(initialDry){
-		Tone.call(this);
-
-		/**
-		 *  connect this input to the dry signal
-		 *  the dry signal is also the default input
-		 *  
-		 *  @type {GainNode}
-		 */
-		this.dry = this.input;
-
-		/**
-		 *  connect this input to the wet signal
-		 *  
-		 *  @type {GainNode}
-		 */
-		this.wet = this.context.createGain();
-		/**
-		 *  controls the amount of wet signal 
-		 *  which is mixed into the dry signal
-		 *  
-		 *  @type {Tone.Signal}
-		 */
-		this.wetness = new Tone.Signal();
-		/**
-		 *  invert the incoming signal
-		 *  @private
-		 *  @type {Tone}
-		 */
-		this._invert = new Tone.Scale(0, 1, 1, 0);
-
-		//connections
-		this.dry.connect(this.output);
-		this.wet.connect(this.output);
-		//wet control
-		this.chain(this.wetness, this.wet.gain);
-		//dry control is the inverse of the wet
-		this.chain(this.wetness, this._invert, this.dry.gain);
-
-		this.dry.gain.value = 0;
-		this.wet.gain.value = 0;
-
-		this.setDry(this.defaultArg(initialDry, 0));
-	};
-
-	Tone.extend(Tone.DryWet);
-
-	/**
-	 * Set the dry value 
-	 * 
-	 * @param {number} val
-	 * @param {Tone.Time=} rampTime
-	 */
-	Tone.DryWet.prototype.setDry = function(val, rampTime){
-		this.setWet(1-val, rampTime);
-	};
-
-	/**
-	 * Set the wet value
-	 * 
-	 * @param {number} val
-	 * @param {Tone.Time=} rampTime
-	 */
-	Tone.DryWet.prototype.setWet = function(val, rampTime){
-		if (rampTime){
-			this.wetness.linearRampToValueNow(val, rampTime);
-		} else {
-			this.wetness.setValue(val);
-		}
-	};
-
-	/**
-	 *  clean up
-	 */
-	Tone.DryWet.prototype.dispose = function(){
-		this.dry.disconnect();
-		this.wet.disconnect();
-		this.wetness.dispose();
-		this._invert.dispose();
-		this.output.disconnect();
-		this.dry = null;
-		this.wet = null;
-		this.wetness = null;
-		this._invert = null;
-		this.output = null;
-	};
-
-	return Tone.DryWet;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Effect.js.html b/doc/Effect.js.html deleted file mode 100644 index f9252c67..00000000 --- a/doc/Effect.js.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - Tone.js Source: effect/Effect.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: effect/Effect.js

- -
-
-
define(["Tone/core/Tone", "Tone/component/DryWet"], function(Tone){
-	
-	/**
-	 * 	Effect is the base class for effects. connect the effect between
-	 * 	the effectSend and effectReturn GainNodes. then control the amount of
-	 * 	effect which goes to the output using the dry/wet control.
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number=} initalDry the starting dry value
-	 *                             defaults to 0.5 (50% dry / 50% wet)
-	 */
-	Tone.Effect = function(initialDry){
-		Tone.call(this);
-
-		/**
-		 *  the drywet knob to control the amount of effect
-		 *  
-		 *  @type {Tone.DryWet}
-		 */
-		this.dryWet = new Tone.DryWet();
-		/**
-		 *  connect the effectSend to the input of hte effect
-		 *  
-		 *  @type {GainNode}
-		 */
-		this.effectSend = this.context.createGain();
-		/**
-		 *  connect the output of the effect to the effectReturn
-		 *  
-		 *  @type {GainNode}
-		 */
-		this.effectReturn = this.context.createGain();
-
-		//connections
-		this.input.connect(this.dryWet.dry);
-		this.input.connect(this.effectSend);
-		this.effectReturn.connect(this.dryWet.wet);
-		this.dryWet.connect(this.output);
-		
-		//setup
-		this.setDry(this.defaultArg(initialDry, 0.5));
-	};
-
-	Tone.extend(Tone.Effect);
-
-	/**
-	 * setDry adjusts the dry / wet balance
-	 * dryness is 0 (100% wet) to 1 (100% dry)
-	 * 
-	 * @param {number} dryness
-	 * @param {Tone.Time=} rampTime
-	 */
-	Tone.Effect.prototype.setDry = function(dryness, rampTime){
-		this.dryWet.setDry(dryness, rampTime);
-	};
-
-	/**
-	 * setWet also adjusts the dry / wet balance
-	 * wetVal is 0 (100% dry) to 1 (100% wet)
-	 * 
-	 * @param {number} wetness
-	 * @param {Tone.Time=} rampTime
-	 */
-	Tone.Effect.prototype.setWet = function(wetVal, rampTime){
-		this.dryWet.setWet(wetVal, rampTime);
-	};
-
-	/**
-	 *  bypass the effect
-	 */
-	Tone.Effect.prototype.bypass = function(){
-		this.setDry(1);
-	};
-
-	/**
-	 *  chains the effect in between the effectSend and effectReturn
-	 *  @param  {Tone} effect
-	 */
-	Tone.Effect.prototype.connectEffect = function(effect){
-		this.chain(this.effectSend, effect, this.effectReturn);
-	};
-
-	/**
-	 *  tear down
-	 */
-	Tone.Effect.prototype.dispose = function(){
-		this.dryWet.dispose();
-		this.input.disconnect();
-		this.output.disconnect();
-		this.effectSend.disconnect();
-		this.effectReturn.disconnect();
-		this.dryWet = null;
-		this.input = null;
-		this.output = null;
-		this.effectSend = null;
-		this.effectReturn = null;
-	};
-
-	return Tone.Effect;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Envelope.js.html b/doc/Envelope.js.html deleted file mode 100644 index 3b1cf33c..00000000 --- a/doc/Envelope.js.html +++ /dev/null @@ -1,389 +0,0 @@ - - - - - - Tone.js Source: component/Envelope.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: component/Envelope.js

- -
-
-
define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
-
-	/**
-	 *  Envelope 
-	 *  ADR envelope generator attaches to an AudioParam or AudioNode
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {Tone.Time=} attack
-	 *  @param {Tone.Time=} decay
-	 *  @param {number=} sustain 	a percentage (0-1) of the full amplitude
-	 *  @param {Tone.Time=} release
-	 *  @param {number=} minOutput the lowest point of the envelope
-	 *  @param {number=} maxOutput the highest point of the envelope
-	 */
-	Tone.Envelope = function(attack, decay, sustain, release, minOutput, maxOutput){
-		//extend Unit
-		Tone.call(this);
-
-		/** @type {number} */
-		this.attack = this.toSeconds(this.defaultArg(attack, 0.01));
-		/** @type {number} */
-		this.decay = this.toSeconds(this.defaultArg(decay, 0.1));
-		/** @type {number} */
-		this.release = this.toSeconds(this.defaultArg(release, 1));
-		/** @type {number} */
-		this.sustain = this.toSeconds(this.defaultArg(sustain, 0.5));
-
-		/** @type {number} */
-		this.min = this.defaultArg(minOutput, 0);
-		/** @type {number} */
-		this.max = this.defaultArg(maxOutput, 1);
-		
-		/** @type {Tone.Signal} */
-		this.control = new Tone.Signal(this.min);
-
-		//connections
-		this.chain(this.control, this.output);
-	};
-
-	Tone.extend(Tone.Envelope);
-
-	/**
-	 * attack->decay->sustain linear ramp
-	 * @param  {Tone.Time=} time
-	 */
-	Tone.Envelope.prototype.triggerAttack = function(time){
-		var sustainVal = (this.max - this.min) * this.sustain + this.min;
-		if (!time){
-			this.control.linearRampToValueNow(this.max, this.attack);
-			this.control.linearRampToValueAtTime(sustainVal, this.now() + this.attack + this.decay);	
-		} else {
-			var startVal = this.min;
-			time = this.toSeconds(time);
-			this.control.cancelScheduledValues(time);
-			this.control.setValueAtTime(startVal, time);
-			this.control.linearRampToValueAtTime(this.max, time + this.attack);
-			this.control.linearRampToValueAtTime(sustainVal, time + this.attack + this.decay);
-		}
-	};
-
-	/**
-	 * attack->decay->sustain exponential attack and linear decay
-	 * @param  {Tone.Time=} time
-	 */
-	Tone.Envelope.prototype.triggerExponentialAttack = function(time){
-		var sustainVal = (this.max - this.min) * this.sustain + this.min;
-		if (!time){
-			this.control.exponentialRampToValueNow(this.max, this.attack);
-			this.control.linearRampToValueAtTime(sustainVal, this.now() + this.attack + this.decay);	
-		} else {
-			var startVal = this.min;
-			time = this.toSeconds(time);
-			this.control.cancelScheduledValues(time);
-			this.control.setValueAtTime(startVal, time);
-			this.control.exponentialRampToValueAtTime(this.max, time + this.attack);
-			this.control.linearRampToValueAtTime(sustainVal, time + this.attack + this.decay);
-		}
-	};
-
-	
-	/**
-	 * triggers the release of the envelope with a linear ramp
-	 * @param  {Tone.Time=} time
-	 */
-	Tone.Envelope.prototype.triggerRelease = function(time){
-		if (time){
-			//if there's a time, start at the sustain value
-			startVal = (this.max - this.min) * this.sustain + this.min;
-			time = this.toSeconds(time);
-			this.control.cancelScheduledValues(time);
-			this.control.setValueAtTime(startVal, time);
-			this.control.linearRampToValueAtTime(this.min, time + this.toSeconds(this.release));
-		} else {
-			this.control.linearRampToValueNow(this.min, this.toSeconds(this.release));
-		}
-	};
-
-
-	/**
-	 * triggers the release of the envelope with an exponential ramp
-	 * 
-	 * @param  {Tone.Time=} time
-	 */
-	Tone.Envelope.prototype.triggerExponentialRelease = function(time){
-		if (time){
-			//if there's a time, start at the sustain value
-			startVal = (this.max - this.min) * this.sustain + this.min;
-			time = this.toSeconds(time);
-			this.control.cancelScheduledValues(time);
-			this.control.setValueAtTime(startVal, time);
-			this.control.exponentialRampToValueAtTime(this.min, time + this.toSeconds(this.release));
-		} else {
-			this.control.exponentialRampToValueNow(this.min, this.toSeconds(this.release));
-		}
-	};
-
-	/**
-	 * 	pointer to the parent's connect method
-	 * 	@private
-	 */
-	Tone.Envelope.prototype._connect = Tone.prototype.connect;
-
-	/**
-	 * connect the envelope
-	 * 
-	 * if the envelope is connected to a param, the params 
-	 * value will be set to 0 so that it doesn't interfere with the envelope
-	 * 
-	 * @param  {number} param
-	 */
-	Tone.Envelope.prototype.connect = function(param){
-		if (param instanceof AudioParam){
-			//set the initial value
-			param.value = 0;
-		} 
-		this._connect(param);
-	};
-
-	/**
-	 *  disconnect and dispose
-	 */
-	Tone.Envelope.prototype.dispose = function(){
-		this.control.dispose();
-		this.control = null;
-	};
-
-	return Tone.Envelope;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/FeedbackDelay.js.html b/doc/FeedbackDelay.js.html deleted file mode 100644 index 23db3d0d..00000000 --- a/doc/FeedbackDelay.js.html +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - Tone.js Source: effect/FeedbackDelay.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: effect/FeedbackDelay.js

- -
-
-
define(["Tone/core/Tone", "Tone/effect/FeedbackEffect", "Tone/signal/Signal"], function(Tone){
-	/**
-	 *  A feedback delay
-	 *
-	 *  @constructor
-	 *  @extends {Tone.FeedbackEffect}
-	 *  @param {Tone.Time=} delayTime
-	 */
-	Tone.FeedbackDelay = function(delayTime){
-		Tone.FeedbackEffect.call(this);
-
-		/**
-		 *  Tone.Signal to control the delay amount
-		 *  @type {Tone.Signal}
-		 */
-		this.delay = new Tone.Signal();
-		/**
-		 *  the delay node
-		 *  @type {DelayNode}
-		 *  @private
-		 */
-		this._delayNode = this.context.createDelay(4);
-
-		// connect it up
-		this.connectEffect(this._delayNode);
-		this.delay.connect(this._delayNode.delayTime);
-		//set the initial delay
-		this.setDelayTime(this.defaultArg(delayTime, 0.25));
-	};
-
-	Tone.extend(Tone.FeedbackDelay, Tone.FeedbackEffect);
-
-	/**
-	 *  Sets the delay time
-	 *  
-	 *  @param {Tone.Time} delayTime 
-	 *  @param {Tone.Time=} rampTime time it takes to reach the desired delayTime
-	 */
-	Tone.FeedbackDelay.prototype.setDelayTime = function(delayTime, rampTime){
-		if (rampTime){
-			this.delay.linearRampToValueNow(this.toSeconds(delayTime), rampTime);
-		} else {
-			this.delay.setValue(this.toSeconds(delayTime));
-		}
-	};
-
-	/**
-	 *  pointer to the feedback effects dispose method
-	 *  @borrows Tone.FeedbackDelay._feedbackEffectDispose as Tone.FeedbackEffect.dispose;
-	 */
-	Tone.FeedbackDelay.prototype._feedbackEffectDispose = Tone.FeedbackEffect.prototype.dispose;
-
-	/**
-	 *  clean up
-	 */
-	Tone.FeedbackDelay.prototype.dispose = function(){
-		this._feedbackEffectDispose();
-		this.delay.dispose();
-		this._delayNode.disconnect();
-		this._delayNode = null;
-		this.delay = null;
-	};
-
-	return Tone.FeedbackDelay;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/FeedbackEffect.js.html b/doc/FeedbackEffect.js.html deleted file mode 100644 index 28c9b848..00000000 --- a/doc/FeedbackEffect.js.html +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - Tone.js Source: effect/FeedbackEffect.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: effect/FeedbackEffect.js

- -
-
-
define(["Tone/core/Tone", "Tone/effect/Effect", "Tone/signal/Signal"], function(Tone){
-	/**
-	 * Feedback Effect (a sound loop between an audio source and its own output)
-	 *
-	 *  @constructor
-	 *  @extends {Tone.Effect}
-	 *  @param {number=} initialFeedback the initial feedback value (defaults to 0.25)
-	 */
-	Tone.FeedbackEffect = function(initialFeedback){
-		Tone.Effect.call(this);
-
-		/**
-		 *  controls the amount of feedback
-		 *  @type {Tone.Signal}
-		 */
-		this.feedback = new Tone.Signal(this.defaultArg(initialFeedback, 0.25));
-		/**
-		 *  the gain which controls the feedback
-		 *  @type {GainNode}
-		 *  @private
-		 */
-		this._feedbackGain = this.context.createGain();
-
-		//the feedback loop
-		this.chain(this.effectReturn, this._feedbackGain, this.effectSend);
-		this.feedback.connect(this._feedbackGain.gain);
-	};
-
-	Tone.extend(Tone.FeedbackEffect, Tone.Effect);
-
-	/**
-	 *  set the feedback amount
-	 *
-	 *  @param {number} value  the amount of feedback
-	 *  @param {Tone.Time=} rampTime (optionally) set the ramp time it takes 
-	 *                               to reach the new feedback value
-	 */
-	Tone.FeedbackEffect.prototype.setFeedback = function(value, rampTime){
-		if (rampTime){
-			this.feedback.linearRampToValueNow(value, rampTime);
-		} else {
-			this.feedback.setValue(value);
-		}
-	};
-
-	/**
-	 *  the parents dispose method
-	 *  @private
-	 *  @borrows Tone.Effect.dispose as Tone.FeedbackEffect._effectDispose
-	 */
-	Tone.FeedbackEffect.prototype._effectDispose = Tone.Effect.prototype.dispose;
-
-	/**
-	 *  clean up
-	 */
-	Tone.FeedbackEffect.prototype.dispose = function(){
-		this._effectDispose();
-		this.feedback.dispose();
-		this._feedbackGain.disconnect();
-		this.feedback = null;
-		this._feedbackGain = null;
-	};
-
-	return Tone.FeedbackEffect;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/LFO.js.html b/doc/LFO.js.html deleted file mode 100644 index b2ac63a8..00000000 --- a/doc/LFO.js.html +++ /dev/null @@ -1,365 +0,0 @@ - - - - - - Tone.js Source: component/LFO.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: component/LFO.js

- -
-
-
define(["Tone/core/Tone", "Tone/source/Oscillator", "Tone/signal/Scale"], function(Tone){
-
-	/**
-	 *  Low Frequency Oscillator
-	 *
-	 *  LFO produces an output signal which can be attached to an AudioParam
-	 *  	for constant control over that parameter
-	 *  	the LFO can also be synced to the transport
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number} rate      
-	 *  @param {number=} outputMin 
-	 *  @param {number=} outputMax
-	 */
-	Tone.LFO = function(rate, outputMin, outputMax){
-		/** @type {GainNode} */
-		this.input = this.context.createGain();
-		/** @type {Tone.Oscillator} */
-		this.oscillator = new Tone.Oscillator(this.defaultArg(rate, 1), "sine");
-		/**
-			@type {Tone.Scale} 
-			@private
-		*/
-		this._scaler = new Tone.Scale(this.defaultArg(outputMin, 0), this.defaultArg(outputMax, 1));
-		/** alias for the output */
-		this.output = this._scaler;
-
-		//connect it up
-		this.chain(this.oscillator, this.output);
-	};
-
-	Tone.extend(Tone.LFO);
-
-	/**
-	 *  start the LFO
-	 *  @param  {Tone.Time} time 
-	 */
-	Tone.LFO.prototype.start = function(time){
-		this.oscillator.start(time);
-	};
-
-	/**
-	 *  stop the LFO
-	 *  @param  {Tone.Time} time 
-	 */
-	Tone.LFO.prototype.stop = function(time){
-		this.oscillator.stop(time);
-	};
-
-	/**
-	 *  Sync the start/stop/pause to the transport 
-	 *  and the frequency to the bpm of the transport
-	 */
-	Tone.LFO.prototype.sync = function(){
-		this.oscillator.sync();
-	};
-
-	/**
-	 *  unsync the LFO from transport control
-	 */
-	Tone.LFO.prototype.unsync = function(){
-		this.oscillator.unsync();
-	};
-
-
-	/**
-	 *  set the frequency
-	 *  @param {number} rate 
-	 */
-	Tone.LFO.prototype.setFrequency = function(rate){
-		this.oscillator.setFrequency(rate);
-	};
-
-	/**
-	 *  set the minimum output of the LFO
-	 *  @param {number} min 
-	 */
-	Tone.LFO.prototype.setMin = function(min){
-		this._scaler.setOutputMin(min);
-	};
-
-	/**
-	 *  set the maximum output of the LFO
-	 *  @param {number} min 
-	 */
-	Tone.LFO.prototype.setMax = function(max){
-		this._scaler.setOuputMax(max);
-	};
-
-	/**
-	 *  set the waveform of the LFO
-	 *  @param {string} type 
-	 */
-	Tone.LFO.prototype.setType = function(type){
-		this.oscillator.setType(type);
-	};
-
-	/**
-	 *  pointer to the parent's connect method
-	 *  @private
-	 */
-	Tone.LFO.prototype._connect = Tone.prototype.connect;
-
-	/**
-	 *	override the connect method so that it 0's out the value 
-	 *	if attached to an AudioParam
-	 *	
-	 *  @borrows Tone.Signal.connect as Tone.LFO.connect
-	 */
-	Tone.LFO.prototype.connect = Tone.Signal.prototype.connect;
-
-	/**
-	 *  disconnect and dispose
-	 */
-	Tone.LFO.prototype.dispose = function(){
-		this.oscillator.dispose();
-		this.output.disconnect();
-		this._scaler.dispose();
-		this.oscillator = null;
-		this.output = null;
-		this._scaler = null;
-	};
-
-	return Tone.LFO;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Master.js.html b/doc/Master.js.html deleted file mode 100644 index 492f500c..00000000 --- a/doc/Master.js.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - Tone.js Source: core/Master.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: core/Master.js

- -
-
-
define(["Tone/core/Tone"], function(Tone){
-	
-	/**
-	 *  Master Output
-	 *  
-	 *  a single master output
-	 *  adds toMaster to Tone
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 */
-	var Master = function(){
-		//extend audio unit
-		Tone.call(this);
-
-		/**
-		 *  put a hard limiter on the output so we don't blow any eardrums
-		 *  
-		 *  @type {DynamicsCompressorNode}
-		 */
-		this.limiter = this.context.createDynamicsCompressor();
-		this.limiter.threshold.value = 0;
-		this.limiter.ratio.value = 20;
-		//connect it up
-		this.chain(this.input, this.limiter, this.output, this.context.destination);
-	};
-
-	Tone.extend(Master);
-
-	/**
-	 *  mute the output
-	 *  @param {boolean} muted
-	 */
-	Master.prototype.mute = function(muted){
-		muted = this.defaultArg(muted, true);
-		if (muted){
-			this.output.gain.value = 0;
-		} else {
-			this.output.gain.value = 1;
-		}
-	};
-
-	/**
-	 *  @param {number} value 
-	 *  @param {Tone.Time=} fadeTime (optional) time it takes to reach the value
-	 */
-	Master.prototype.setVolume = function(value, fadeTime){
-		var now = this.now();
-		if (fadeTime){
-			var currentVolume = this.output.gain.value;
-			this.output.gain.cancelScheduledValues(now);
-			this.output.gain.setValueAtTime(currentVolume, now);
-			this.output.gain.linearRampToValueAtTime(value, now + this.toSeconds(time));
-		} else {
-			this.output.gain.setValueAtTime(value, now);
-		}
-	};
-
-	///////////////////////////////////////////////////////////////////////////
-	//	AUGMENT TONE's PROTOTYPE
-	///////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  connect 'this' to the master output
-	 */
-	Tone.prototype.toMaster = function(){
-		this.connect(Tone.Master);
-	};
-
-	/**
-	 *  Also augment AudioNode's prototype to include toMaster
-	 *  as a convenience
-	 */
-	AudioNode.prototype.toMaster = function(){
-		this.connect(Tone.Master);
-	};
-
-	/**
-	 *  a silent connection to the DesinationNode
-	 *  which will ensure that anything connected to it
-	 *  will not be garbage collected
-	 *  
-	 *  @private
-	 */
-	var _silentNode = Tone.context.createGain();
-	_silentNode.gain.value = 0;
-	_silentNode.connect(Tone.context.destination);
-
-	/**
-	 *  makes a connection to ensure that the node will not be garbage collected
-	 *  until 'dispose' is explicitly called
-	 *
-	 *  use carefully. circumvents JS and WebAudio's normal Garbage Collection behavior
-	 */
-	Tone.prototype.noGC = function(){
-		this.output.connect(_silentNode);
-	};
-
-	AudioNode.prototype.noGC = function(){
-		this.connect(_silentNode);
-	};
-
-	//a single master output
-	Tone.Master = new Master();
-
-	return Tone.Master;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Merge.js.html b/doc/Merge.js.html deleted file mode 100644 index 1779fbd0..00000000 --- a/doc/Merge.js.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - Tone.js Source: signal/Merge.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: signal/Merge.js

- -
-
-
define(["Tone/core/Tone"], function(Tone){
-
-	/**
-	 *  merge a left and a right channel into a single stereo channel
-	 *
-	 *  instead of connecting to the input, connect to either the left, or right input
-	 *
-	 *  default input for connect is left input
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 */
-	Tone.Merge = function(){
-
-		Tone.call(this);
-
-		/**
-		 *  the left input channel
-		 *  also an alias for the input
-		 *  @type {GainNode}
-		 */
-		this.left = this.input;
-		/**
-		 *  the right input channel
-		 *  @type {GainNode}
-		 */
-		this.right = this.context.createGain();
-		/**
-		 *  the merger node for the two channels
-		 *  @type {ChannelMergerNode}
-		 */
-		this.merger = this.context.createChannelMerger(2);
-
-		//connections
-		this.left.connect(this.merger, 0, 0);
-		this.right.connect(this.merger, 0, 1);
-		this.merger.connect(this.output);
-	};
-
-	Tone.extend(Tone.Merge);
-
-	/**
-	 *  clean up
-	 */
-	Tone.Merge.prototype.dispose = function(){
-		this.input.disconnect();
-		this.right.disconnect();
-		this.merger.disconnect();
-		this.input = null;
-		this.right = null;
-		this.merger = null;
-	}; 
-
-	return Tone.Merge;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Meter.js.html b/doc/Meter.js.html deleted file mode 100644 index e5c64ec2..00000000 --- a/doc/Meter.js.html +++ /dev/null @@ -1,395 +0,0 @@ - - - - - - Tone.js Source: component/Meter.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: component/Meter.js

- -
-
-
define(["Tone/core/Tone", "Tone/core/Master"], function(Tone){
-
-	/**
-	 *  get the rms of the input signal with some averaging
-	 *  can also just get the value of the signal
-	 *  or the value in dB
-	 *  
-	 *  inspired by https://github.com/cwilso/volume-meter/blob/master/volume-meter.js
-	 *  The MIT License (MIT) Copyright (c) 2014 Chris Wilson
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number=} channels (optional) number of channels being metered
-	 *  @param {number=} smoothing (optional) amount of smoothing applied to the volume
-	 *  @param {number=} clipMemory (optional) number in ms that a "clip" should be remembered
-	 */
-	Tone.Meter = function(channels, smoothing, clipMemory){
-		//extends Unit
-		Tone.call(this);
-
-		/** @type {number} */
-		this.channels = this.defaultArg(channels, 1);
-
-		/** @type {number} */
-		this.smoothing = this.defaultArg(smoothing, 0.8);
-
-		/** @type {number} */
-		this.clipMemory = this.defaultArg(clipMemory, 500);
-
-		/** 
-		 *  the rms for each of the channels
-		 *  @private
-		 *  @type {Array<number>}
-		 */
-		this._volume = new Array(this.channels);
-
-		/** 
-		 *  the raw values for each of the channels
-		 *  @private
-		 *  @type {Array<number>}
-		 */
-		this._values = new Array(this.channels);
-
-		//zero out the volume array
-		for (var i = 0; i < this.channels; i++){
-			this._volume[i] = 0;
-			this._values[i] = 0;
-		}
-
-		/** 
-		 *  last time the values clipped
-		 *  @private
-		 *  @type {number}
-		 */
-		this._lastClip = 0;
-		
-		/** 
-		 *  @private
-		 *  @type {ScriptProcessorNode}
-		 */
-		this._jsNode = this.context.createScriptProcessor(this.bufferSize, this.channels, 1);
-		this._jsNode.onaudioprocess = this._onprocess.bind(this);
-		//so it doesn't get garbage collected
-		this._jsNode.noGC();
-
-		//signal just passes
-		this.input.connect(this.output);
-		this.input.connect(this._jsNode);
-	};
-
-	Tone.extend(Tone.Meter);
-
-	/**
-	 *  called on each processing frame
-	 *  @private
-	 *  @param  {AudioProcessingEvent} event 
-	 */
-	Tone.Meter.prototype._onprocess = function(event){
-		var bufferSize = this._jsNode.bufferSize;
-		var smoothing = this.smoothing;
-		for (var channel = 0; channel < this.channels; channel++){
-			var input = event.inputBuffer.getChannelData(channel);
-			var sum = 0;
-			var total = 0;
-			var x;
-			var clipped = false;
-			for (var i = 0; i < bufferSize; i++){
-				x = input[i];
-				if (!clipped && x > 0.95){
-					clipped = true;
-					this._lastClip = Date.now();
-				}
-				total += x;
-		    	sum += x * x;
-			}
-			var average = total / bufferSize;
-			var rms = Math.sqrt(sum / bufferSize);
-			this._volume[channel] = Math.max(rms, this._volume[channel] * smoothing);
-			this._values[channel] = average;
-		}
-	};
-
-	/**
-	 *  get the rms of the signal
-	 *  	
-	 *  @param  {number=} channel which channel
-	 *  @return {number}         the value
-	 */
-	Tone.Meter.prototype.getLevel = function(channel){
-		channel = this.defaultArg(channel, 0);
-		var vol = this._volume[channel];
-		if (vol < 0.00001){
-			return 0;
-		} else {
-			return vol;
-		}
-	};
-
-	/**
-	 *  get the value of the signal
-	 *  @param  {number=} channel 
-	 *  @return {number}         
-	 */
-	Tone.Meter.prototype.getValue = function(channel){
-		channel = this.defaultArg(channel, 0);
-		return this._values[channel];
-	};
-
-	/**
-	 *  get the volume of the signal in dB
-	 *  @param  {number=} channel 
-	 *  @return {number}         
-	 */
-	Tone.Meter.prototype.getDb = function(channel){
-		return this.gainToDb(this.getLevel(channel));
-	};
-
-	// @returns {boolean} if the audio has clipped in the last 500ms
-	Tone.Meter.prototype.isClipped = function(){
-		return Date.now() - this._lastClip < this.clipMemory;
-	};
-
-	/**
-	 *  @override
-	 */
-	Tone.Meter.prototype.dispose = function(){
-		this._jsNode.disconnect();
-		this._jsNode.onaudioprocess = null;
-		this._volume = null;
-		this._values = null;
-		this.input.disconnect();
-		this.output.disconnect();
-	};
-
-	return Tone.Meter;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Microphone.js.html b/doc/Microphone.js.html deleted file mode 100644 index 10f0d44d..00000000 --- a/doc/Microphone.js.html +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - Tone.js Source: source/Microphone.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: source/Microphone.js

- -
-
-
///////////////////////////////////////////////////////////////////////////////
-//
-//	WEB RTC MICROPHONE
-//
-///////////////////////////////////////////////////////////////////////////////
-
-define(["Tone/core/Tone", "Tone/source/Source"], function(Tone){
-
-	/**
-	 *  WebRTC Microphone
-	 *
-	 *  CHROME ONLY (for now) because of the 
-	 *  use of the MediaStreamAudioSourceNode
-	 *
-	 *  @constructor
-	 *  @extends {Tone.Source}
-	 *  @param {number=} inputNum 
-	 */
-	Tone.Microphone = function(inputNum){
-		Tone.Source.call(this);
-
-		/**
-		 *  @type {MediaStreamAudioSourceNode}
-		 *  @private
-		 */
-		this._mediaStream = null;
-		/**
-		 *  @type {LocalMediaStream}
-		 *  @private
-		 */
-		this._stream = null;
-		/**
-		 *  @type {Object}
-		 *  @private
-		 */
-		this.constraints = {"audio" : true};
-
-		//get the option
-		var self = this;
-		MediaStreamTrack.getSources(function (media_sources) {
-			if (inputNum < media_sources.length){
-				self.constraints.audio = {
-					optional : [{ sourceId: media_sources[inputNum].id}]
-				};
-			}
-		});		
-	};
-
-	Tone.extend(Tone.Microphone, Tone.Source);
-
-	/**
-	 *  start the stream. 
-	 */
-	Tone.Microphone.prototype.start = function(){
-		if (this.state === Tone.Source.State.STOPPED){
-			this.state = Tone.Source.State.STARTED;
-				navigator.getUserMedia(this.constraints, 
-					this._onStream.bind(this), this._onStreamError.bind(this));
-		}
-	};
-
-	/**
-	 *  stop the stream. 
-	 */
-	Tone.Microphone.prototype.stop = function(){
-		if (this._stream && this.state === Tone.Source.State.STARTED){
-			this.state = Tone.Source.State.STOPPED;
-			this._stream.stop();
-		}
-	};
-
-	/**
-	 *  called when the stream is successfully setup
-	 *  @param   {LocalMediaStream} stream 
-	 *  @private
-	 */
-	Tone.Microphone.prototype._onStream = function(stream) {
-		this._stream = stream;
-		// Wrap a MediaStreamSourceNode around the live input stream.
-		this._mediaStream = this.context.createMediaStreamSource(stream);
-		this._mediaStream.connect(this.output);
-	};
-
-	/**
-	 *  called on error
-	 *  @param   {Error} e 
-	 *  @private
-	 */
-	Tone.Microphone.prototype._onStreamError = function(e) {
-		console.error(e);
-	};
-
-	/**
-	 *  clean up
-	 */
-	Tone.Microphone.prototype.dispose = function(e) {
-		this.input.disconnect();
-		this.output.disconnect();
-		this._stream.disconnect();
-		this._mediaStream.disconnect();
-		this.input = null;
-		this.output = null;
-		this._stream = null;
-		this._mediaStream = null;
-	};
-
-	//polyfill
-	navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || 
-		navigator.mozGetUserMedia || navigator.msGetUserMedia;
-
-	return Tone.Microphone;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Multiply.js.html b/doc/Multiply.js.html deleted file mode 100644 index 31ffd608..00000000 --- a/doc/Multiply.js.html +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - Tone.js Source: signal/Multiply.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: signal/Multiply.js

- -
-
-
define(["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){
-
-	/**
-	 *  Multiply the incoming signal by some factor
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number=} value constant value to multiple
-	 */
-	Tone.Multiply = function(value){
-		/**
-		 *  the input node is the same as the output node
-		 *  it is also the GainNode which handles the scaling of incoming signal
-		 *  
-		 *  @type {GainNode}
-		 */
-		this.input = this.context.createGain();
-		/** 
-		 *  @type {GainNode}
-		 */
-		this.output = this.input;
-
-		//apply the inital scale factor
-		this.input.gain.value = this.defaultArg(value, 1);
-	};
-
-	Tone.extend(Tone.Multiply);
-
-	/**
-	 *  set the constant multiple
-	 *  	
-	 *  @param {number} value 
-	 */
-	Tone.Multiply.prototype.setValue = function(value){
-		this.input.gain.value = value;
-	};
-
-	/**
-	 *  clean up
-	 */
-	Tone.Multiply.prototype.dispose = function(){
-		this.input.disconnect();
-		this.input = null;
-	}; 
-
-	return Tone.Multiply;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Noise.js.html b/doc/Noise.js.html deleted file mode 100644 index 019bb87e..00000000 --- a/doc/Noise.js.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - Tone.js Source: source/Noise.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: source/Noise.js

- -
-
-
define(["Tone/core/Tone", "Tone/source/Source"], function(Tone){
-
-	var sampleRate = Tone.context.sampleRate;
-	//two seconds per buffer
-	var bufferLength = sampleRate * 4;
-
-	/**
-	 *  Noise generator. 
-	 *
-	 *  uses looped noise buffers to save on performance. 
-	 *
-	 *  @constructor
-	 *  @extends {Tone.Source}
-	 *  @param {string} type the noise type (white|pink|brown)
-	 */
-	Tone.Noise = function(type){
-
-		Tone.Source.call(this);
-
-		/**
-		 *  @private
-		 *  @type {AudioBufferSourceNode}
-		 */
-		this._source = null;
-		
-		/**
-		 *  the buffer
-		 *  @private
-		 *  @type {AudioBuffer}
-		 */
-		this._buffer = null;
-
-		/**
-		 *  set a callback function to invoke when the sample is over
-		 *  
-		 *  @type {function}
-		 */
-		this.onended = function(){};
-
-		this.setType(this.defaultArg(type, "white"));
-	};
-
-	Tone.extend(Tone.Noise, Tone.Source);
-
-	/**
-	 *  set the noise type
-	 *  
-	 *  @param {string} type the noise type (white|pink|brown)
-	 *  @param {Tone.Time} time (optional) time that the set will occur
-	 */
-	Tone.Noise.prototype.setType = function(type, time){
-		switch (type){
-			case "white" : 
-				this._buffer = _whiteNoise;
-				break;
-			case "pink" : 
-				this._buffer = _pinkNoise;
-				break;
-			case "brown" : 
-				this._buffer = _brownNoise;
-				break;
-			default : 
-				this._buffer = _whiteNoise;
-		}
-		//if it's playing, stop and restart it
-		if (this.state === Tone.Source.State.STARTED){
-			time = this.toSeconds(time);
-			//remove the listener
-			this._source.onended = undefined;
-			this._stop(time);
-			this._start(time);
-		}
-	};
-
-	/**
-	 *  internal start method
-	 *  
-	 *  @param {Tone.Time} time
-	 *  @private
-	 */
-	Tone.Noise.prototype._start = function(time){		
-		this._source = this.context.createBufferSource();
-		this._source.buffer = this._buffer;
-		this._source.loop = true;
-		this._source.start(this.toSeconds(time));
-		this.chain(this._source, this.output);
-		this._source.onended = this._onended.bind(this);
-	};
-
-	/**
-	 *  start the noise at a specific time
-	 *  
-	 *  @param {Tone.Time} time
-	 */
-	Tone.Noise.prototype.start = function(time){
-		if (this.state === Tone.Source.State.STOPPED){
-			this.state = Tone.Source.State.STARTED;
-			//make the source
-			this._start(time);
-		}
-	};
-
-	/**
-	 *  internal stop method
-	 *  
-	 *  @param {Tone.Time} time
-	 *  @private
-	 */
-	Tone.Noise.prototype._stop = function(time){
-		this._source.stop(this.toSeconds(time));
-	};
-
-
-	/**
-	 *  stop the noise at a specific time
-	 *  
-	 *  @param {Tone.Time} time
-	 */
-	Tone.Noise.prototype.stop = function(time){
-		if (this.state === Tone.Source.State.STARTED) {
-			if (this._buffer && this._source){
-				if (!time){
-					this.state = Tone.Source.State.STOPPED;
-				}
-				this._stop(time);
-			}
-		}
-	};
-
-	/**
-	 *  internal call when the buffer is done playing
-	 *  
-	 *  @private
-	 */
-	Tone.Noise.prototype._onended = function(){
-		this.state = Tone.Source.State.STOPPED;
-		this.onended();
-	};
-
-	/**
-	 *  dispose all the components
-	 */
-	Tone.Noise.prototype.dispose = function(){
-		if (this._source !== null){
-			this._source.disconnect();
-			this._source = null;
-		}
-		this._buffer = null;
-		this.output.disconnect();
-		this.output = null;
-	};
-
-
-	///////////////////////////////////////////////////////////////////////////
-	// THE BUFFERS
-	// borred heavily from http://noisehack.com/generate-noise-web-audio-api/
-	///////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *	static brown noise buffer
-	 *  
-	 *  @static
-	 *  @private
-	 *  @type {AudioBuffer}
-	 */
-	var _pinkNoise = (function() {
-		var buffer = Tone.context.createBuffer(2, bufferLength, sampleRate);
-		for (var channelNum = 0; channelNum < buffer.numberOfChannels; channelNum++){
-			var channel = buffer.getChannelData(channelNum);
-			var b0, b1, b2, b3, b4, b5, b6;
-			b0 = b1 = b2 = b3 = b4 = b5 = b6 = 0.0;
-			for (var i = 0; i < bufferLength; i++) {
-				var white = Math.random() * 2 - 1;
-				b0 = 0.99886 * b0 + white * 0.0555179;
-				b1 = 0.99332 * b1 + white * 0.0750759;
-				b2 = 0.96900 * b2 + white * 0.1538520;
-				b3 = 0.86650 * b3 + white * 0.3104856;
-				b4 = 0.55000 * b4 + white * 0.5329522;
-				b5 = -0.7616 * b5 - white * 0.0168980;
-				channel[i] = b0 + b1 + b2 + b3 + b4 + b5 + b6 + white * 0.5362;
-				channel[i] *= 0.11; // (roughly) compensate for gain
-				b6 = white * 0.115926;
-			}
-		}
-		return buffer;
-	}());
-
-	/**
-	 *	static brown noise buffer
-	 *  
-	 *  @static
-	 *  @private
-	 *  @type {AudioBuffer}
-	 */
-	var _brownNoise = (function() {
-		var buffer = Tone.context.createBuffer(2, bufferLength, sampleRate);
-		for (var channelNum = 0; channelNum < buffer.numberOfChannels; channelNum++){
-			var channel = buffer.getChannelData(channelNum);
-			var lastOut = 0.0;
-			for (var i = 0; i < bufferLength; i++) {
-				var white = Math.random() * 2 - 1;
-				channel[i] = (lastOut + (0.02 * white)) / 1.02;
-				lastOut = channel[i];
-				channel[i] *= 3.5; // (roughly) compensate for gain
-			}
-		}
-		return buffer;
-	})();
-
-	/**
-	 *	static white noise buffer
-	 *  
-	 *  @static
-	 *  @private
-	 *  @type {AudioBuffer}
-	 */
-	var _whiteNoise = (function(){
-		var buffer = Tone.context.createBuffer(2, bufferLength, sampleRate);
-		for (var channelNum = 0; channelNum < buffer.numberOfChannels; channelNum++){
-			var channel = buffer.getChannelData(channelNum);
-			for (var i = 0; i < bufferLength; i++){
-				channel[i] =  Math.random() * 2 - 1;
-			}
-		}
-		return buffer;
-	}());
-
-	return Tone.Noise;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Oscillator.js.html b/doc/Oscillator.js.html deleted file mode 100644 index 523ecbb4..00000000 --- a/doc/Oscillator.js.html +++ /dev/null @@ -1,392 +0,0 @@ - - - - - - Tone.js Source: source/Oscillator.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: source/Oscillator.js

- -
-
-
define(["Tone/core/Tone", "Tone/core/Transport", "Tone/signal/Signal", "Tone/source/Source"], 
-function(Tone){
-
-	/**
-	 *  Oscillator
-	 *
-	 *  Oscilator with start, pause, stop and sync to Transport
-	 *
-	 *  @constructor
-	 *  @extends {Tone.Source}
-	 *  @param {number|string=} freq starting frequency
-	 *  @param {string=} type type of oscillator (sine|square|triangle|sawtooth)
-	 */
-	Tone.Oscillator = function(freq, type){
-		Tone.Source.call(this);
-
-		/**
-		 *  the main oscillator
-		 *  @type {OscillatorNode}
-		 */
-		this.oscillator = this.context.createOscillator();
-		/**
-		 *  the frequency control signal
-		 *  @type {Tone.Signal}
-		 */
-		this.frequency = new Tone.Signal(this.defaultArg(this.toFrequency(freq), 440));
-
-		/**
-		 *  @type {function()}
-		 */
-		this.onended = function(){};
-
-		//connections
-		this.oscillator.connect(this.output);
-		//setup
-		this.oscillator.type = this.defaultArg(type, "sine");
-	};
-
-	Tone.extend(Tone.Oscillator, Tone.Source);
-
-	/**
-	 *  start the oscillator
-	 *  
-	 *  @param  {Tone.Time} time 
-	 */
-	Tone.Oscillator.prototype.start = function(time){
-		if (this.state === Tone.Source.State.STOPPED){
-			this.state = Tone.Source.State.STARTED;
-			//get previous values
-			var type = this.oscillator.type;
-			var detune = this.oscillator.detune.value;
-			//new oscillator with previous values
-			this.oscillator = this.context.createOscillator();
-			this.oscillator.type = type;
-			this.oscillator.detune.value = detune;
-			//connect the control signal to the oscillator frequency
-			this.oscillator.connect(this.output);
-			this.frequency.connect(this.oscillator.frequency);
-			this.oscillator.frequency.value = 0;
-			//start the oscillator
-			this.oscillator.start(this.toSeconds(time));
-			this.oscillator.onended = this._onended.bind(this);
-		}
-	};
-
-	/**
-	 *  stop the oscillator
-	 *  @param  {Tone.Time=} time (optional) timing parameter
-	 */
-	Tone.Oscillator.prototype.stop = function(time){
-		if (this.state === Tone.Source.State.STARTED){
-			if (!time){
-				this.state = Tone.Source.State.STOPPED;
-			}
-			this.oscillator.stop(this.toSeconds(time));
-		}
-	};
-
-	/**
-	 *  Sync the oscillator to the transport
-	 *
-	 *  the current ratio between the oscillator and the Transport BPM
-	 *  is fixed and any change to the Transport BPM will change this
-	 *  oscillator in that same ratio
-	 *
-	 *  Transport start/pause/stop will also start/pause/stop the oscillator
-	 */
-	Tone.Oscillator.prototype.sync = function(){
-		if (this.state !== Tone.Source.State.SYNCED){
-			this.state = Tone.Source.State.SYNCED;
-			Tone.Transport.sync(this);
-			Tone.Transport.syncSignal(this.frequency);
-		}
-	};
-
-	/**
-	 *  unsync the oscillator from the Transport
-	 */
-	Tone.Oscillator.prototype.unsync = function(){
-		if (this.state === Tone.Source.State.SYNCED){
-			Tone.Transport.unsync(this);
-			this.frequency.unsync();
-		}
-	};
-
-	/**
-	 *  exponentially ramp the frequency of the oscillator over the rampTime
-	 *  
-	 *  @param {Tone.Time}	val
-	 *  @param {Tone.Time=} rampTime when the oscillator will arrive at the frequency
-	 */
-	Tone.Oscillator.prototype.setFrequency = function(val, rampTime){
-		if (rampTime){
-			this.frequency.exponentialRampToValueAtTime(this.toFrequency(val), this.toSeconds(rampTime));
-		} else {
-			this.frequency.setValue(this.toFrequency(val));
-		}
-	};
-
-	/**
-	 *  set the oscillator type
-	 *  
-	 *  @param {string} type (sine|square|triangle|sawtooth)
-	 */
-	Tone.Oscillator.prototype.setType = function(type){
-		this.oscillator.type = type;
-	};
-
-	/**
-	 *  internal on end call
-	 *  @private
-	 */
-	Tone.Oscillator.prototype._onended = function(){
-		this.state = Tone.Source.State.STOPPED;
-		this.onended();
-	};
-
-	/**
-	 *  dispose and disconnect
-	 */
-	Tone.Oscillator.prototype.dispose = function(){
-		if (this.oscillator !== null){
-			this.oscillator.disconnect();
-			this.oscillator = null;
-		}
-		this.frequency.dispose();
-		this.frequency = null;
-		this.output.disconnect();
-		this.output = null;
-	};
-
-	return Tone.Oscillator;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Panner.js.html b/doc/Panner.js.html deleted file mode 100644 index 4908b78d..00000000 --- a/doc/Panner.js.html +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - Tone.js Source: component/Panner.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: component/Panner.js

- -
-
-
define(["Tone/core/Tone", "Tone/component/DryWet", "Tone/signal/Merge", "Tone/signal/Split"], 
-function(Tone){
-
-	/**
-	 *  Panner. 
-	 *  
-	 *  Equal Power Gain L/R Panner. Not 3D
-	 *  
-	 *  a panner uses a dry/wet knob internally
-	 *
-	 *  0 = 100% Left
-	 *  1 = 100% Right
-	 *  
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number=} initialPan the initail panner value (defaults to 0.5 = center)
-	 */
-	Tone.Panner = function(initialPan){
-		
-		Tone.call(this);
-
-		/**
-		 *  the dry/wet knob
-		 *  @type {Tone.DryWet}
-		 *  @private
-		 */
-		this._dryWet = new Tone.DryWet();
-		/**
-		 *  @type {Tone.Merge}
-		 *  @private
-		 */
-		this._merger = new Tone.Merge();
-		/**
-		 *  @type {Tone.Split}
-		 *  @private
-		 */
-		this._splitter = new Tone.Split();
-		/**
-		 *  the pan control
-		 *  @type {Tone.Signal}
-		 */	
-		this.pan = this._dryWet.wetness;
-
-		//CONNECTIONS:
-		this.input.connect(this._splitter.left);
-		this.input.connect(this._splitter.right);
-		//left channel is dry, right channel is wet
-		this._splitter.left.connect(this._dryWet.dry);
-		this._splitter.right.connect(this._dryWet.wet);
-		//merge it back together
-		this._dryWet.dry.connect(this._merger.left);
-		this._dryWet.wet.connect(this._merger.right);
-		this._merger.connect(this.output);
-
-		//initial value
-		this.setPan(this.defaultArg(initialPan, 0.5));
-	};
-
-	Tone.extend(Tone.Panner);
-
-	/**
-	 *  set the l/r pan.
-	 *  
-	 *  0 = 100% left.
-	 *  1 = 100% right.
-	 *  
-	 *  @param {number} pan 0-1
-	 *  @param {Tone.Time=} rampTime (optionally) ramp to the pan position
-	 */
-	Tone.Panner.prototype.setPan = function(pan, rampTime){
-		this._dryWet.setWet(pan, rampTime);
-	};
-
-	/**
-	 *  clean up
-	 */
-	Tone.Panner.prototype.dispose = function(){
-		this._dryWet.dispose();
-		this._splitter.dispose();
-		this._merger.dispose();
-		this.input.disconnect();
-		this.output.disconnect();
-		this._dryWet = null;
-		this._splitter = null;
-		this._merger = null;
-		this.input = null;
-		this.output = null;
-	};
-
-	return Tone.Panner;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/PingPongDelay.js.html b/doc/PingPongDelay.js.html deleted file mode 100644 index 36ec46d8..00000000 --- a/doc/PingPongDelay.js.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - Tone.js Source: effect/PingPongDelay.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: effect/PingPongDelay.js

- -
-
-
define(["Tone/core/Tone", "Tone/effect/FeedbackDelay", "Tone/signal/Split", "Tone/signal/Merge"], function(Tone){
-	/**
-	 *  PingPongDelay is a dual delay effect where the echo is heard first in one channel and next in the opposite channel
-	 *
-	 * 	@constructor
-	 * 	@extends {Tone.Effect}
-	 *  @param {Tone.Time=} delayTime is the interval between consecutive echos
-	 */
-	Tone.PingPongDelay = function(delayTime){
-		Tone.call(this);
-
-		/**
-		 *  merge the delayed signal
-		 */
-		this._merger = new Tone.Merge();
-		/**
-		 *  each channel (left/right) gets a feedback delay
-		 *  @type {Tone.FeedbackDelay}
-		 */
-		this.leftDelay = new Tone.FeedbackDelay(delayTime);
-		/**
-		 *  @type {Tone.FeedbackDelay}
-		 */
-		this.rightDelay = new Tone.FeedbackDelay(delayTime);
-
-		//connect it up
-		this.input.connect(this.leftDelay);
-		this.input.connect(this.rightDelay);
-
-		//disconnect the feedback lines to connect them to the other delay
-		// http://jvzaudio.files.wordpress.com/2011/04/delay-f43.gif
-		this.leftDelay._feedbackGain.disconnect();
-		this.rightDelay._feedbackGain.disconnect();
-		this.leftDelay._feedbackGain.connect(this.rightDelay.effectSend);
-		this.rightDelay._feedbackGain.connect(this.leftDelay.effectSend);
-
-		this.leftDelay.connect(this._merger.left);
-		this.rightDelay.connect(this._merger.right);
-
-		this._merger.connect(this.output);
-
-		//initial vals;
-		this.setDelayTime(this.defaultArg(delayTime, 0.25));
-	};
-
-	Tone.extend(Tone.PingPongDelay);
-
-	/**
-	 * setDelayTime
-	 * 
-	 * @param {Tone.Time} delayTime
-	 */
-	Tone.PingPongDelay.prototype.setDelayTime = function(delayTime){
-		this.leftDelay.setDelayTime(delayTime);
-		this.rightDelay.setDelayTime(delayTime * 2);
-	};
-
-	/**
-	 * setFeedback
-	 *
-	 * @param {number} feedback (0 - 1)
-	 */
-	Tone.PingPongDelay.prototype.setFeedback = function(feedback){
-		this.leftDelay.setFeedback(feedback);
-		this.rightDelay.setFeedback(feedback);
-	};
-
-	/**
-	 * setWet
-	 *
-	 * @param {number} wet (0 - 1)
-	 */
-	Tone.PingPongDelay.prototype.setWet = function(wet){
-		this.leftDelay.setWet(wet);
-		this.rightDelay.setWet(wet);
-	};
-
-	/**
-	 * setDry
-	 *
-	 * @param {number} dry (0 - 1)
-	 */
-	Tone.PingPongDelay.prototype.setDry = function(dry){
-		this.leftDelay.setDry(dry);
-		this.rightDelay.setDry(dry);
-	};
-
-	return Tone.PingPongDelay;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Player.js.html b/doc/Player.js.html deleted file mode 100644 index 0402f818..00000000 --- a/doc/Player.js.html +++ /dev/null @@ -1,466 +0,0 @@ - - - - - - Tone.js Source: source/Player.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: source/Player.js

- -
-
-
define(["Tone/core/Tone", "Tone/source/Source"], function(Tone){
-	
-	/**
-	 *  Audio Player
-	 *  
-	 *  Audio file player with start, loop, stop.
-	 *  
-	 *  @constructor
-	 *  @extends {Tone.Source} 
-	 *  @param {string=} url if a url is passed in, it will be loaded
-	 *                       and invoke the callback if it also passed
-	 *                       in.
-	 *  @param {function(Tone.Player)=} onload callback to be invoked
-	 *                                     once the url is loaded
-	 */
-	Tone.Player = function(url, onload){
-		Tone.Source.call(this);
-
-		/**
-		 *  @private
-		 *  @type {AudioBufferSourceNode}
-		 */
-		this._source = null;
-		
-		/**
-		 *  the buffer
-		 *  @private
-		 *  @type {AudioBuffer}
-		 */
-		this._buffer = null;
-
-
-		/**
-		 *  the duration of the buffer once it's been loaded
-		 *  @type {number}
-		 */
-		this.duration = 0;
-
-		/**
-		 *  the playback rate
-		 *  @private
-		 *  @type {number}
-		 */
-		this._playbackRate = 1;
-
-		/**
-		 *  enabling retrigger will allow a player to be restarted
-		 *  before the it's is done playing
-		 *  
-		 *  @type {boolean}
-		 */
-		this.retrigger = false;
-
-		/**
-		 *  set a callback function to invoke when the sample is over
-		 *  
-		 *  @type {function}
-		 */
-		this.onended = function(){};
-
-		//if there is a url, load it. 
-		if (url){
-			this.load(url, onload);
-		}
-	};
-
-	Tone.extend(Tone.Player, Tone.Source);
-
-	/**
-	 *  makes an xhr reqest for the selected url
-	 *  Load the audio file as an audio buffer.
-	 *  Decodes the audio asynchronously and invokes
-	 *  the callback once the audio buffer loads.
-	 *
-	 *  @param {string} url the url of the buffer to load.
-	 *                      filetype support depends on the
-	 *                      browser.
-	 *  @param {function(Tone.Player)=} callback
-	 */
-	Tone.Player.prototype.load = function(url, callback){
-		if (!this._buffer){
-			var request = new XMLHttpRequest();
-			request.open("GET", url, true);
-			request.responseType = "arraybuffer";
-			// decode asynchronously
-			var self = this;
-			request.onload = function() {
-				self.context.decodeAudioData(request.response, function(buff) {
-					self.setBuffer(buff);
-					if (callback){
-						callback(self);
-					}
-				});
-			};
-			//send the request
-			request.send();
-		} else {
-			if (callback){
-				callback(this);
-			}
-		}
-	};
-
-	/**
-	 *  set the buffer
-	 *
-	 *  @param {AudioBuffer} buffer the buffer which the player will play.
-	 *                              note: if you switch the buffer after
-	 *                              the player is already started, it will not
-	 *                              take effect until the next time the player
-	 *                              is started.
-	 */
-	Tone.Player.prototype.setBuffer = function(buffer){
-		this._buffer = buffer;
-		this.duration = buffer.duration;
-	};
-
-	/**
-	 *  play the buffer between the desired positions
-	 *  	
-	 *  @param  {Tone.Time=} startTime 
-	 *  @param  {Tone.Time=} offset    
-	 *  @param  {Tone.Time=} duration
-	 */
-	Tone.Player.prototype.start = function(startTime, offset, duration){
-		if (this.state === Tone.Source.State.STOPPED || this.retrigger){
-			if (this._buffer){
-				this.state = Tone.Source.State.STARTED;
-				//default args
-				offset = this.defaultArg(offset, 0);
-				duration = this.defaultArg(duration, this._buffer.duration - offset);
-				//make the source
-				this._source = this.context.createBufferSource();
-				this._source.buffer = this._buffer;
-				this._source.loop = false;
-				this._source.playbackRate.value = this._playbackRate;
-				this._source.start(this.toSeconds(startTime), this.toSeconds(offset), this.toSeconds(duration));
-				this._source.onended = this._onended.bind(this);
-				this.chain(this._source, this.output);
-			}
-		}
-	};
-
-	/**
-	 *  Loop the buffer from start to finish at a time
-	 *
-	 *  @param  {Tone.Time=} startTime
-	 *  @param  {Tone.Time=} loopStart
-	 *  @param  {Tone.Time=} loopEnd
-	 *  @param  {Tone.Time=} offset
-	 *  @param  {Tone.Time=} duration
-	 */
-	Tone.Player.prototype.loop = function(startTime, loopStart, loopEnd, offset, duration){
-		if (this._buffer){
-			//default args
-			loopStart = this.defaultArg(loopStart, 0);
-			loopEnd = this.defaultArg(loopEnd, this._buffer.duration);
-			offset = this.defaultArg(offset, loopStart);
-			duration = this.defaultArg(duration, this._buffer.duration - offset);
-			//make/play the source
-			this.start(startTime, offset, duration);
-			this._source.loop = true;
-			this._source.loopStart = this.toSeconds(loopStart);
-			this._source.loopEnd = this.toSeconds(loopEnd);
-		}
-	};
-
-	/**
-	 *  Stop playback.
-	 * 
-	 *  @param  {Tone.Time} time
-	 */
-	Tone.Player.prototype.stop = function(time){
-		if (this.state === Tone.Source.State.STARTED) {
-			if (this._buffer && this._source){
-				if (!time){
-					this.state = Tone.Source.State.STOPPED;
-				}
-				this._source.stop(this.toSeconds(time));
-			}
-		}
-	};
-
-	/**
-	 *  set the rate at which the file plays
-	 *  
-	 *  @param {number} rate
-	 *  @param {Tone.Time=} rampTime (optional) the amount of time it takes to 
-	 *                               reach the rate
-	 */
-	Tone.Player.prototype.setPlaybackRate = function(rate, rampTime){
-		this._playbackRate = rate;
-		if (this._source) {
-			if (rampTime){
-				this._source.playbackRate.exponentialRampToValueAtTime(rate, this.toSeconds(rampTime));
-			} else {
-				this._source.playbackRate.value = rampTime;
-			}
-		} 
-	};
-
-	/**
-	 *  internal call when the buffer is done playing
-	 *  
-	 *  @private
-	 */
-	Tone.Player.prototype._onended = function(){
-		this.state = Tone.Source.State.STOPPED;
-		this.onended();
-	};
-
-	/**
-	 *  dispose and disconnect
-	 */
-	Tone.Player.prototype.dispose = function(){
-		if (this._source !== null){
-			this._source.disconnect();
-			this._source = null;
-		}
-		this._buffer = null;
-		this.output.disconnect();
-		this.output = null;
-	};
-
-	return Tone.Player;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Recorder.js.html b/doc/Recorder.js.html deleted file mode 100644 index 5ad32398..00000000 --- a/doc/Recorder.js.html +++ /dev/null @@ -1,475 +0,0 @@ - - - - - - Tone.js Source: component/Recorder.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: component/Recorder.js

- -
-
-
define(["Tone/core/Tone", "Tone/core/Master"], function(Tone){
-
-	/**
-	 *  Record an input into an array or AudioBuffer
-	 *
-	 *  it is limited in that the recording length needs to be known beforehand
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number} channels 
-	 */
-	Tone.Recorder = function(channels){
-
-		Tone.call(this);
-
-		/**
-		 *  the number of channels in the recording
-		 *  @type {number}
-		 */
-		this.channels = this.defaultArg(channels, 1);
-
-		/**
-		 *  @private
-		 *  @type {ScriptProcessorNode}
-		 */
-		this._jsNode = this.context.createScriptProcessor(this.bufferSize, this.channels, 1);
-		this._jsNode.onaudioprocess = this._audioprocess.bind(this);
-
-		/**
-		 *  Float32Array for each channel
-		 *  @private
-		 *  @type {Array<Float32Array>}
-		 */
-		this._recordBuffers = new Array(this.channels);
-
-		/**
-		 *  @type {number}
-		 *  @private
-		 */
-		this._recordStartSample = 0;
-
-		/**
-		 *  @type {number}
-		 *  @private
-		 */
-		this._recordEndSample = 0;
-
-		/**
-		 *  @type {number}
-		 *  @private
-		 */
-		this._recordDuration = 0;
-
-		/**
-		 *  @type {RecordState}
-		 */
-		this.state = RecordState.STOPPED;
-
-		/** 
-		 *  @private
-		 *  @type {number}
-		 */
-		this._recordBufferOffset = 0;
-
-		/** 
-		 *  callback invoked when the recording is over
-		 *  @private
-		 *  @type {function(Float32Array)}
-		 */
-		this._callback = function(){};
-
-		//connect it up
-		this.input.connect(this._jsNode);
-		//pass thru audio
-		this.input.connect(this.output);
-		//so it doesn't get garbage collected
-		this._jsNode.noGC();
-		//clear it to start
-		this.clear();
-	};
-
-	Tone.extend(Tone.Recorder);
-
-	/**
-	 *  internal method called on audio process
-	 *  
-	 *  @private
-	 *  @param   {AudioProcessorEvent} event 
-	 */
-	Tone.Recorder.prototype._audioprocess = function(event){
-		if (this.state === RecordState.STOPPED){
-			return;
-		} else if (this.state === RecordState.RECORDING){
-			//check if it's time yet
-			var now = this.defaultArg(event.playbackTime, this.now());
-			var processPeriodStart = this.toSamples(now);
-			var bufferSize = this._jsNode.bufferSize;
-			var processPeriodEnd = processPeriodStart + bufferSize;
-			var bufferOffset, len;
-			if (processPeriodStart > this._recordEndSample){
-				this.state = RecordState.STOPPED;
-				this._callback(this._recordBuffers);
-			} else if (processPeriodStart > this._recordStartSample) {
-				bufferOffset = 0;
-				len = Math.min(this._recordEndSample - processPeriodStart, bufferSize);
-				this._recordChannels(event.inputBuffer, bufferOffset, len, bufferSize);
-			} else if (processPeriodEnd > this._recordStartSample) {
-				len = processPeriodEnd - this._recordStartSample;
-				bufferOffset = bufferSize - len;
-				this._recordChannels(event.inputBuffer, bufferOffset, len, bufferSize);
-			} 
-
-		}
-	};
-
-	/**
-	 *  record an input channel
-	 *  @param   {AudioBuffer} inputBuffer        
-	 *  @param   {number} from  
-	 *  @param   {number} to  
-	 *  @private
-	 */
-	Tone.Recorder.prototype._recordChannels = function(inputBuffer, from, to, bufferSize){
-		var offset = this._recordBufferOffset;
-		var buffers = this._recordBuffers;
-		for (var channelNum = 0; channelNum < inputBuffer.numberOfChannels; channelNum++){
-			var channel = inputBuffer.getChannelData(channelNum);
-			if ((from === 0) && (to === bufferSize)){
-				//set the whole thing
-				this._recordBuffers[channelNum].set(channel, offset);
-			} else {
-				for (var i = from; i < from + to; i++){
-					var zeroed = i - from; 
-					buffers[channelNum][zeroed + offset] = channel[i];				
-				}
-			}
-		}
-		this._recordBufferOffset += to;
-	};	
-
-	/**
-	 *  Record for a certain period of time
-	 *  
-	 *  will clear the internal buffer before starting
-	 *  
-	 *  @param  {Tone.Time} duration 
-	 *  @param  {Tone.Time} wait the wait time before recording
-	 *  @param {function(Float32Array)} callback the callback to be invoked when the buffer is done recording
-	 */
-	Tone.Recorder.prototype.record = function(duration, startTime, callback){
-		if (this.state === RecordState.STOPPED){
-			this.clear();
-			this._recordBufferOffset = 0;
-			startTime = this.defaultArg(startTime, 0);
-			this._recordDuration = this.toSamples(duration);
-			this._recordStartSample = this.toSamples("+"+startTime);
-			this._recordEndSample = this._recordStartSample + this._recordDuration;
-			for (var i = 0; i < this.channels; i++){
-				this._recordBuffers[i] = new Float32Array(this._recordDuration);
-			}
-			this.state = RecordState.RECORDING;
-			this._callback = this.defaultArg(callback, function(){});
-		}
-	};
-
-	/**
-	 *  clears the recording buffer
-	 */
-	Tone.Recorder.prototype.clear = function(){
-		for (var i = 0; i < this.channels; i++){
-			this._recordBuffers[i] = null;
-		}
-		this._recordBufferOffset = 0;
-	};
-
-
-	/**
-	 *  true if there is nothing in the buffers
-	 *  @return {boolean} 
-	 */
-	Tone.Recorder.prototype.isEmpty = function(){
-		return this._recordBuffers[0] === null;
-	};
-
-	/**
-	 *  @return {Array<Float32Array>}
-	 */
-	Tone.Recorder.prototype.getFloat32Array = function(){
-		if (this.isEmpty()){
-			return null;
-		} else {
-			return this._recordBuffers;
-		}
-	};
-
-	/**
-	 *  @return {AudioBuffer}
-	 */
-	Tone.Recorder.prototype.getAudioBuffer = function(){
-		if (this.isEmpty()){
-			return null;
-		} else {
-			var audioBuffer = this.context.createBuffer(this.channels, this._recordBuffers[0].length, this.context.sampleRate);
-			for (var channelNum = 0; channelNum < audioBuffer.numberOfChannels; channelNum++){
-				var channel = audioBuffer.getChannelData(channelNum);
-				channel.set(this._recordBuffers[channelNum]);
-			}
-			return audioBuffer;
-		}
-	};
-
-	/**
-	 *  clean up
-	 */
-	Tone.Recorder.prototype.dispose = function(){
-		this.output.disconnect();
-		this.input.disconnect();
-		this._jsNode.disconnect();
-		this._jsNode.onaudioprocess = undefined;
-		this.output = null;
-		this.input = null;
-		this._jsNode = null;
-		this._recordBuffers = null;
-	};
-
-	/**
-	 *  @enum {string}
-	 */
-	var RecordState = {
-		STOPPED : "stopped",
-		SCHEDULED : "scheduled",
-		RECORDING : "recording"
-	};
-
-	return Tone.Recorder;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Scale.js.html b/doc/Scale.js.html deleted file mode 100644 index adba7089..00000000 --- a/doc/Scale.js.html +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - Tone.js Source: signal/Scale.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: signal/Scale.js

- -
-
-
define(["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Multiply"], function(Tone){
-	
-	/**
-	 *  performs a linear scaling on an input signal
-	 *
-	 *  scales from the input range of inputMin to inputMax 
-	 *  to the output range of outputMin to outputMax
-	 *
-	 *  if only two arguments are provided, the inputMin and inputMax are set to -1 and 1
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number} inputMin  
-	 *  @param {number} inputMax  
-	 *  @param {number=} outputMin 
-	 *  @param {number=} outputMax 
-	 */
-	Tone.Scale = function(inputMin, inputMax, outputMin, outputMax){
-		Tone.call(this);
-
-		//if there are only two args
-		if (arguments.length == 2){
-			outputMin = inputMin;
-			outputMax = inputMax;
-			inputMin = -1;
-			inputMax = 1;
-		}
-
-		/** @private 
-			@type {number} */
-		this._inputMin = inputMin;
-		/** @private 
-			@type {number} */
-		this._inputMax = inputMax;
-		/** @private 
-			@type {number} */
-		this._outputMin = outputMin;
-		/** @private 
-			@type {number} */
-		this._outputMax = outputMax;
-
-
-		/** @private 
-			@type {Tone.Add} */
-		this._plusInput = new Tone.Add(0);
-		/** @private 
-			@type {Tone.Multiply} */
-		this._scale = new Tone.Multiply(1);
-		/** @private 
-			@type {Tone.Add} */
-		this._plusOutput = new Tone.Add(0);
-
-		//connections
-		this.chain(this.input, this._plusInput, this._scale, this._plusOutput, this.output);
-
-		//set the scaling values
-		this._setScalingParameters();
-	};
-
-	Tone.extend(Tone.Scale);
-
-	/**
-	 *  set the scaling parameters
-	 *  
-	 *  @private
-	 */
-	Tone.Scale.prototype._setScalingParameters = function(){
-		//components
-		this._plusInput.setValue(-this._inputMin);
-		this._scale.setValue((this._outputMax - this._outputMin)/(this._inputMax - this._inputMin));
-		this._plusOutput.setValue(this._outputMin);
-	};
-
-	/**
-	 *  set the input min value
-	 *  @param {number} val 
-	 */
-	Tone.Scale.prototype.setInputMin = function(val){
-		this._inputMin = val;
-		this._setScalingParameters();
-	};
-
-	/**
-	 *  set the input max value
-	 *  @param {number} val 
-	 */
-	Tone.Scale.prototype.setInputMax = function(val){
-		this._inputMax = val;
-		this._setScalingParameters();
-	};
-
-	/**
-	 *  set the output min value
-	 *  @param {number} val 
-	 */
-	Tone.Scale.prototype.setOutputMin = function(val){
-		this._outputMin = val;
-		this._setScalingParameters();
-	};
-
-	/**
-	 *  set the output max value
-	 *  @param {number} val 
-	 */
-	Tone.Scale.prototype.setOutputMax = function(val){
-		this._outputMax = val;
-		this._setScalingParameters();
-	};
-
-	/**
-	 *  clean up
-	 */
-	Tone.Scale.prototype.dispose = function(){
-		this.input.disconnect();
-		this.output.disconnect();
-		this._plusInput.dispose();
-		this._plusOutput.dispose();
-		this._scale.dispose();
-		this.input = null;
-		this.output = null;
-		this._plusInput = null;
-		this._plusOutput = null;
-		this._scale = null;
-	}; 
-
-
-	return Tone.Scale;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Signal.js.html b/doc/Signal.js.html deleted file mode 100644 index 940865c6..00000000 --- a/doc/Signal.js.html +++ /dev/null @@ -1,543 +0,0 @@ - - - - - - Tone.js Source: signal/Signal.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: signal/Signal.js

- -
-
-
define(["Tone/core/Tone", "Tone/core/Master"], function(Tone){
-
-	/**
-	 *	all signals share a common constant signal generator
-	 *  
-	 *  @static
-	 *  @private
-	 *  @type {OscillatorNode} 
-	 */
-	var generator = Tone.context.createOscillator();
-
-	/**
-	 *  @static
-	 *  @private
-	 *  @type {WaveShaperNode} 
-	 */
-	var constant = Tone.context.createWaveShaper();
-
-	//generate the waveshaper table which outputs 1 for any input value
-	(function(){
-		var len = 8;
-		var curve = new Float32Array(len);
-		for (var i = 0; i < len; i++){
-			//all inputs produce the output value
-			curve[i] = 1;
-		}
-		constant.curve = curve;
-	})();
-
-	generator.connect(constant);
-	generator.start(0);
-	generator.noGC();
-
-	/**
-	 *  constant audio-rate signal
-	 *
-	 *  Tone.Signal is a core component which allows for synchronization of many components. 
-	 *  A single signal can drive multiple parameters by applying Scaling. 
-	 *
-	 *  For example: to synchronize two Tone.Oscillators in octaves of each other, 
-	 *  	Signal --> OscillatorA.frequency
-	 *  		  ^--> Tone.Multiply(2) --> OscillatorB.frequency
-	 *  
-	 *
-	 *  Tone.Signal can be scheduled with all of the functions available to AudioParams
-	 *
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 *  @param {number=} value (optional) initial value
-	 */
-	Tone.Signal = function(value){
-
-		Tone.call(this);
-
-		/**
-		 *  scales the constant output to the desired output
-		 *  @type {GainNode}
-		 */
-		this.scalar = this.context.createGain();
-		/**
-		 *  the ratio of the this value to the control signal value
-		 *
-		 *  @private
-		 *  @type {number}
-		 */
-		this._syncRatio = 1;
-
-		//connect the constant 1 output to the node output
-		this.chain(constant, this.scalar, this.output);
-		//signal passes through
-		this.input.connect(this.output);
-
-		//set the default value
-		this.setValue(this.defaultArg(value, 0));
-	};
-
-	Tone.extend(Tone.Signal);
-
-	/**
-	 *  @return {number} the current value of the signal
-	 */
-	Tone.Signal.prototype.getValue = function(){
-		return this.scalar.gain.value;
-	};
-
-	/**
-	 *  set the value of the signal right away
-	 *  will be overwritten if there are previously scheduled automation curves
-	 *  
-	 *  @param {number} value 
-	 */
-	Tone.Signal.prototype.setValue = function(value){
-		if (this._syncRatio === 0){
-			value = 0;
-		} else {
-			value *= this._syncRatio;
-		}
-		this.scalar.gain.value = value;
-	};
-
-	/**
-	 *  Schedules a parameter value change at the given time.
-	 *  
-	 *  @param {number}		value 
-	 *  @param {Tone.Time}  time 
-	 */
-	Tone.Signal.prototype.setValueAtTime = function(value, time){
-		value *= this._syncRatio;
-		this.scalar.gain.setValueAtTime(value, this.toSeconds(time));
-	};
-
-	/**
-	 *  creates a schedule point with the current value at the current time
-	 *
-	 *  @param {number=} now (optionally) pass the now value in
-	 *  @returns {number} the current value
-	 */
-	Tone.Signal.prototype.setCurrentValueNow = function(now){
-		now = this.defaultArg(now, this.now());
-		var currentVal = this.getValue();
-		this.cancelScheduledValues(now);
-		this.scalar.gain.setValueAtTime(currentVal, now);
-		return currentVal;
-	};
-
-	/**
-	 *  Schedules a linear continuous change in parameter value from the 
-	 *  previous scheduled parameter value to the given value.
-	 *  
-	 *  @param  {number} value   
-	 *  @param  {Tone.Time} endTime 
-	 */
-	Tone.Signal.prototype.linearRampToValueAtTime = function(value, endTime){
-		value *= this._syncRatio;
-		this.scalar.gain.linearRampToValueAtTime(value, this.toSeconds(endTime));
-	};
-
-	/**
-	 *  Schedules an exponential continuous change in parameter value from 
-	 *  the previous scheduled parameter value to the given value.
-	 *
-	 *  NOTE: Chrome will throw an error if you try to exponentially ramp to a 
-	 *  value 0 or less. 
-	 *  
-	 *  @param  {number} value   
-	 *  @param  {Tone.Time} endTime 
-	 */
-	Tone.Signal.prototype.exponentialRampToValueAtTime = function(value, endTime){
-		value *= this._syncRatio;
-		this.scalar.gain.exponentialRampToValueAtTime(value, this.toSeconds(endTime));
-	};
-
-	/**
-	 *  Schedules an exponential continuous change in parameter value from 
-	 *  the current time and current value to the given value.
-	 *  
-	 *  @param  {number} value   
-	 *  @param  {Tone.Time} endTime 
-	 */
-	Tone.Signal.prototype.exponentialRampToValueNow = function(value, endTime){
-		var now = this.now();
-		this.setCurrentValueNow(now);
-		value *= this._syncRatio;
-		//make sure that the endTime doesn't start with +
-		if (endTime.toString().charAt(0) === "+"){
-			endTime = endTime.substr(1);
-		}
-		this.scalar.gain.exponentialRampToValueAtTime(value, now + this.toSeconds(endTime));
-	};
-
-	/**
-	 *  Schedules an linear continuous change in parameter value from 
-	 *  the current time and current value to the given value at the given time.
-	 *  
-	 *  @param  {number} value   
-	 *  @param  {Tone.Time} endTime 
-	 */
-	Tone.Signal.prototype.linearRampToValueNow = function(value, endTime){
-		var now = this.now();
-		this.setCurrentValueNow(now);
-		value *= this._syncRatio;
-		//make sure that the endTime doesn't start with +
-		if (endTime.toString().charAt(0) === "+"){
-			endTime = endTime.substr(1);
-		}
-		this.scalar.gain.linearRampToValueAtTime(value, now + this.toSeconds(endTime));
-	};
-
-	/**
-	 *  Start exponentially approaching the target value at the given time with
-	 *  a rate having the given time constant.
-	 *  	
-	 *  @param {number} value        
-	 *  @param {Tone.Time} startTime    
-	 *  @param {number} timeConstant 
-	 */
-	Tone.Signal.prototype.setTargetAtTime = function(value, startTime, timeConstant){
-		value *= this._syncRatio;
-		this.output.gain.setTargetAtTime(value, this.toSeconds(startTime), timeConstant);
-	};
-
-	/**
-	 *  Sets an array of arbitrary parameter values starting at the given time
-	 *  for the given duration.
-	 *  	
-	 *  @param {Array<number>} values    
-	 *  @param {Tone.Time} startTime 
-	 *  @param {Tone.Time} duration  
-	 */
-	Tone.Signal.prototype.setValueCurveAtTime = function(values, startTime, duration){
-		for (var i = 0; i < values.length; i++){
-			values[i] *= this._syncRatio;
-		}
-		this.scalar.gain.setValueCurveAtTime(values, this.toSeconds(startTime), this.toSeconds(duration));
-	};
-
-	/**
-	 *  Cancels all scheduled parameter changes with times greater than or 
-	 *  equal to startTime.
-	 *  
-	 *  @param  {Tone.Time} startTime
-	 */
-	Tone.Signal.prototype.cancelScheduledValues = function(startTime){
-		this.scalar.gain.cancelScheduledValues(this.toSeconds(startTime));
-	};
-
-	/**
-	 *  Sync this to another signal and it will always maintain the 
-	 *  ratio between the two signals until it is unsynced
-	 *
-	 *  Signals can only be synced to one other signal. while syncing, 
-	 *  if a signal's value is changed, the new ratio between the signals
-	 *  is maintained as the syncing signal is changed. 
-	 *  
-	 *  @param  {Tone.Signal} signal to sync to
-	 *  @param {number=} ratio optionally pass in the ratio between 
-	 *                         the two signals, otherwise it will be computed
-	 */
-	Tone.Signal.prototype.sync = function(signal, ratio){
-		if (ratio){
-			this._syncRatio = ratio;
-		} else {
-			//get the sync ratio
-			if (signal.getValue() !== 0){
-				this._syncRatio = this.getValue() / signal.getValue();
-			} else {
-				this._syncRatio = 0;
-			}
-		}
-		//make a new scalar which is not connected to the constant signal
-		this.scalar.disconnect();
-		this.scalar = this.context.createGain();
-		this.chain(signal, this.scalar, this.output);
-		//set it ot the sync ratio
-		this.scalar.gain.value = this._syncRatio;
-	};
-
-	/**
-	 *  unbind the signal control
-	 *
-	 *  will leave the signal value as it was without the influence of the control signal
-	 */
-	Tone.Signal.prototype.unsync = function(){
-		//make a new scalar so that it's disconnected from the control signal
-		//get the current gain
-		var currentGain = this.getValue();
-		this.scalar.disconnect();
-		this.scalar = this.context.createGain();
-		this.scalar.gain.value = currentGain / this._syncRatio;
-		this._syncRatio = 1;
-		//reconnect things up
-		this.chain(constant, this.scalar, this.output);
-	};
-
-	/**
-	 *  internal dispose method to tear down the node
-	 */
-	Tone.Signal.prototype.dispose = function(){
-		//disconnect everything
-		this.output.disconnect();
-		this.scalar.disconnect();
-		this.output = null;
-		this.scalar = null;
-	};
-
-	/**
-	 *  Signals can connect to other Signals
-	 *
-	 *  @override
-	 *  @param {AudioParam|AudioNode|Tone.Signal|Tone} node 
-	 */
-	Tone.Signal.prototype.connect = function(node){
-		//zero it out so that the signal can have full control
-		if (node instanceof Tone.Signal){
-			node.setValue(0);
-		} else if (node instanceof AudioParam){
-			node.value = 0;
-		} 
-		this.output.connect(node);
-	};
-
-	return Tone.Signal;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Source.js.html b/doc/Source.js.html deleted file mode 100644 index 4d6239ba..00000000 --- a/doc/Source.js.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - Tone.js Source: source/Source.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: source/Source.js

- -
-
-
define(["Tone/core/Tone", "Tone/core/Transport"], function(Tone){
-	/**
-	 *  base class for sources
-	 *
-	 *  sources have start/stop/pause
-	 *
-	 *  they also have the ability to be synced to the 
-	 *  start/stop/pause of Tone.Transport
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 */	
-	Tone.Source = function(){
-		/**
-		 *  unlike most ToneNodes, Sources only have an output and no input
-		 *  
-		 *  @type {GainNode}
-		 */
-		this.output = this.context.createGain();
-
-		/**
-		 *  @type {Tone.Source.State}
-		 */
-		this.state = Tone.Source.State.STOPPED;
-	};
-
-	Tone.extend(Tone.Source);
-
-	/**
-	 *  @abstract
-	 *  @param  {Tone.Time} time 
-	 */
-	Tone.Source.prototype.start = function(){};
-
-	/**
- 	 *  @abstract
-	 *  @param  {Tone.Time} time 
-	 */
-	Tone.Source.prototype.stop = function(){};
-
-
-	/**
- 	 *  @abstract
-	 *  @param  {Tone.Time} time 
-	 */
-	Tone.Source.prototype.pause = function(time){
-		//if there is no pause, just stop it
-		this.stop(time);
-	};
-
-	/**
-	 *  sync the source to the Transport
-	 */
-	Tone.Source.prototype.sync = function(){
-		if (this.state !== Tone.Source.State.SYNCED){
-			this.state = Tone.Source.State.SYNCED;
-			Tone.Transport.sync(this);
-		}
-	};
-
-	/**
-	 *  unsync the source to the Transport
-	 */
-	Tone.Source.prototype.unsync = function(){
-		if (this.state === Tone.Source.State.SYNCED){
-			Tone.Transport.unsync(this);
-		}
-	};
-
-
-	/**
-	 *  @param {number} value 
-	 *  @param {Tone.Time=} fadeTime (optional) time it takes to reach the value
-	 */
-	Tone.Source.prototype.setVolume = function(value, fadeTime){
-		var now = this.now();
-		if (fadeTime){
-			var currentVolume = this.output.gain.value;
-			this.output.gain.cancelScheduledValues(now);
-			this.output.gain.setValueAtTime(currentVolume, now);
-			this.output.gain.linearRampToValueAtTime(value, now + this.toSeconds(time));
-		} else {
-			this.output.gain.setValueAtTime(value, now);
-		}
-	};
-
-	/**
-	 *  @enum {string}
-	 */
-	Tone.Source.State = {
-		STARTED : "started",
-		PAUSED : "paused",
-		STOPPED : "stopped",
-		SYNCED : "synced"
- 	};
-
-	return Tone.Source;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Split.js.html b/doc/Split.js.html deleted file mode 100644 index 5d782379..00000000 --- a/doc/Split.js.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - Tone.js Source: signal/Split.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: signal/Split.js

- -
-
-
define(["Tone/core/Tone"], function(Tone){
-
-	/**
-	 *	split the incoming signal into left and right channels
-	 *
-	 *  the left channel is the default output
-	 *  
-	 *  @constructor
-	 *  @extends {Tone}
-	 */
-	Tone.Split = function(){
-		Tone.call(this);
-
-		/** 
-		 *  @type {ChannelSplitterNode}
-		 */
-		this.splitter = this.context.createChannelSplitter(2);
-		/** 
-		 *  left channel output
-		 *  @type {GainNode}
-		 */
-		this.left = this.output;
-		/**
-		 *  the right channel output
-		 *  @type {GainNode}
-		 */
-		this.right = this.context.createGain();
-		
-		//connections
-		this.input.connect(this.splitter);
-		this.splitter.connect(this.left, 0, 0);
-		this.splitter.connect(this.right, 1, 0);
-	};
-
-	Tone.extend(Tone.Split);
-
-	/**
-	 *  dispose method
-	 */
-	Tone.Split.prototype.dispose = function(){
-		this.splitter.disconnect();
-		this.input.disconnect();
-		this.output.disconnect();
-		this.splitter = null;
-		this.input = null;
-		this.output = null;
-	}; 
-
-	return Tone.Split;
-});
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/Tone.Add.html b/doc/Tone.Add.html index 9459f168..ca052567 100644 --- a/doc/Tone.Add.html +++ b/doc/Tone.Add.html @@ -254,7 +254,7 @@
Source:
@@ -355,7 +355,7 @@
Source:
@@ -424,7 +424,7 @@
Source:
@@ -554,7 +554,7 @@
Source:
@@ -683,7 +683,7 @@
Source:
@@ -806,7 +806,7 @@
Source:
@@ -971,7 +971,7 @@
Source:
@@ -1064,7 +1064,7 @@
Source:
@@ -1133,7 +1133,7 @@
Source:
@@ -1257,7 +1257,7 @@
Source:
@@ -1399,7 +1399,7 @@
Source:
@@ -1550,7 +1550,7 @@
Source:
@@ -1692,7 +1692,7 @@
Source:
@@ -1880,7 +1880,7 @@
Source:
@@ -2018,7 +2018,7 @@
Source:
@@ -2117,7 +2117,7 @@
Source:
@@ -2286,7 +2286,7 @@
Source:
@@ -2504,7 +2504,7 @@
Source:
@@ -2593,7 +2593,7 @@
Source:
@@ -2739,7 +2739,7 @@
Source:
@@ -2862,7 +2862,7 @@
Source:
@@ -3004,7 +3004,7 @@
Source:
@@ -3169,7 +3169,7 @@
Source:
@@ -3306,7 +3306,7 @@
Source:
@@ -3429,7 +3429,7 @@
Source:
@@ -3526,7 +3526,7 @@
Source:
@@ -3649,7 +3649,7 @@
Source:
@@ -3839,7 +3839,7 @@
Source:
@@ -4031,7 +4031,7 @@
Source:
@@ -4100,7 +4100,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:31 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:10 GMT-0400 (EDT). diff --git a/doc/Tone.AutoPanner.html b/doc/Tone.AutoPanner.html index d42c1a98..0ca8d532 100644 --- a/doc/Tone.AutoPanner.html +++ b/doc/Tone.AutoPanner.html @@ -299,7 +299,7 @@
Source:
@@ -385,7 +385,7 @@
Source:
@@ -454,7 +454,7 @@
Source:
@@ -523,7 +523,7 @@
Source:
@@ -592,7 +592,7 @@
Source:
@@ -661,7 +661,7 @@
Source:
@@ -725,7 +725,7 @@
Source:
@@ -794,7 +794,7 @@
Source:
@@ -858,7 +858,7 @@
Source:
@@ -928,7 +928,7 @@
Source:
@@ -1062,7 +1062,7 @@
Source:
@@ -1191,7 +1191,7 @@
Source:
@@ -1314,7 +1314,7 @@
Source:
@@ -1437,7 +1437,7 @@
Source:
@@ -1602,7 +1602,7 @@
Source:
@@ -1695,7 +1695,7 @@
Source:
@@ -1764,7 +1764,7 @@
Source:
@@ -1888,7 +1888,7 @@
Source:
@@ -2030,7 +2030,7 @@
Source:
@@ -2181,7 +2181,7 @@
Source:
@@ -2323,7 +2323,7 @@
Source:
@@ -2511,7 +2511,7 @@
Source:
@@ -2649,7 +2649,7 @@
Source:
@@ -2748,7 +2748,7 @@
Source:
@@ -2917,7 +2917,7 @@
Source:
@@ -3135,7 +3135,7 @@
Source:
@@ -3224,7 +3224,7 @@
Source:
@@ -3370,7 +3370,7 @@
Source:
@@ -3493,7 +3493,7 @@
Source:
@@ -3635,7 +3635,7 @@
Source:
@@ -3800,7 +3800,7 @@
Source:
@@ -3986,7 +3986,7 @@ dryness is 0 (100% wet) to 1 (100% dry)

Source:
@@ -4107,7 +4107,7 @@ dryness is 0 (100% wet) to 1 (100% dry)

Source:
@@ -4225,7 +4225,7 @@ dryness is 0 (100% wet) to 1 (100% dry)

Source:
@@ -4392,7 +4392,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4522,7 +4522,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4652,7 +4652,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4775,7 +4775,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4872,7 +4872,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4995,7 +4995,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -5185,7 +5185,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -5377,7 +5377,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -5446,7 +5446,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)


- Documentation generated on Mon Jun 23 2014 14:51:31 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:10 GMT-0400 (EDT). diff --git a/doc/Tone.BitCrusher.html b/doc/Tone.BitCrusher.html index f48fcd1d..3f6a4ac0 100644 --- a/doc/Tone.BitCrusher.html +++ b/doc/Tone.BitCrusher.html @@ -300,7 +300,7 @@
Source:
@@ -401,7 +401,7 @@
Source:
@@ -470,7 +470,7 @@
Source:
@@ -600,7 +600,7 @@
Source:
@@ -729,7 +729,7 @@
Source:
@@ -852,7 +852,7 @@
Source:
@@ -1017,7 +1017,7 @@
Source:
@@ -1110,7 +1110,7 @@
Source:
@@ -1179,7 +1179,7 @@
Source:
@@ -1303,7 +1303,7 @@
Source:
@@ -1445,7 +1445,7 @@
Source:
@@ -1596,7 +1596,7 @@
Source:
@@ -1738,7 +1738,7 @@
Source:
@@ -1926,7 +1926,7 @@
Source:
@@ -2064,7 +2064,7 @@
Source:
@@ -2163,7 +2163,7 @@
Source:
@@ -2332,7 +2332,7 @@
Source:
@@ -2550,7 +2550,7 @@
Source:
@@ -2639,7 +2639,7 @@
Source:
@@ -2785,7 +2785,7 @@
Source:
@@ -2908,7 +2908,7 @@
Source:
@@ -3050,7 +3050,7 @@
Source:
@@ -3215,7 +3215,7 @@
Source:
@@ -3352,7 +3352,7 @@
Source:
@@ -3470,7 +3470,7 @@
Source:
@@ -3593,7 +3593,7 @@
Source:
@@ -3690,7 +3690,7 @@
Source:
@@ -3813,7 +3813,7 @@
Source:
@@ -4003,7 +4003,7 @@
Source:
@@ -4195,7 +4195,7 @@
Source:
@@ -4264,7 +4264,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:32 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:10 GMT-0400 (EDT). diff --git a/doc/Tone.DryWet.html b/doc/Tone.DryWet.html index 05f993c6..472a2108 100644 --- a/doc/Tone.DryWet.html +++ b/doc/Tone.DryWet.html @@ -269,7 +269,7 @@
Source:
@@ -360,7 +360,7 @@
Source:
@@ -424,7 +424,7 @@
Source:
@@ -489,7 +489,7 @@
Source:
@@ -554,7 +554,7 @@
Source:
@@ -715,7 +715,7 @@
Source:
@@ -876,7 +876,7 @@
Source:
@@ -926,7 +926,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:32 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:11 GMT-0400 (EDT). diff --git a/doc/Tone.Effect.html b/doc/Tone.Effect.html index 212487f0..80312074 100644 --- a/doc/Tone.Effect.html +++ b/doc/Tone.Effect.html @@ -269,7 +269,7 @@
Source:
@@ -365,7 +365,7 @@
Source:
@@ -429,7 +429,7 @@
Source:
@@ -493,7 +493,7 @@
Source:
@@ -562,7 +562,7 @@
Source:
@@ -631,7 +631,7 @@
Source:
@@ -696,7 +696,7 @@
Source:
@@ -830,7 +830,7 @@
Source:
@@ -959,7 +959,7 @@
Source:
@@ -1077,7 +1077,7 @@
Source:
@@ -1200,7 +1200,7 @@
Source:
@@ -1365,7 +1365,7 @@
Source:
@@ -1458,7 +1458,7 @@
Source:
@@ -1527,7 +1527,7 @@
Source:
@@ -1651,7 +1651,7 @@
Source:
@@ -1793,7 +1793,7 @@
Source:
@@ -1944,7 +1944,7 @@
Source:
@@ -2086,7 +2086,7 @@
Source:
@@ -2274,7 +2274,7 @@
Source:
@@ -2412,7 +2412,7 @@
Source:
@@ -2511,7 +2511,7 @@
Source:
@@ -2680,7 +2680,7 @@
Source:
@@ -2898,7 +2898,7 @@
Source:
@@ -2987,7 +2987,7 @@
Source:
@@ -3133,7 +3133,7 @@
Source:
@@ -3256,7 +3256,7 @@
Source:
@@ -3398,7 +3398,7 @@
Source:
@@ -3563,7 +3563,7 @@
Source:
@@ -3744,7 +3744,7 @@ dryness is 0 (100% wet) to 1 (100% dry)

Source:
@@ -3906,7 +3906,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4029,7 +4029,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4126,7 +4126,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4249,7 +4249,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4439,7 +4439,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4631,7 +4631,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4700,7 +4700,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)


- Documentation generated on Mon Jun 23 2014 14:51:32 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:11 GMT-0400 (EDT). diff --git a/doc/Tone.Envelope.html b/doc/Tone.Envelope.html index 990e9bc2..0d9aed71 100644 --- a/doc/Tone.Envelope.html +++ b/doc/Tone.Envelope.html @@ -432,7 +432,7 @@
Source:
@@ -524,7 +524,7 @@
Source:
@@ -584,7 +584,7 @@
Source:
@@ -644,7 +644,7 @@
Source:
@@ -713,7 +713,7 @@
Source:
@@ -773,7 +773,7 @@
Source:
@@ -833,7 +833,7 @@
Source:
@@ -902,7 +902,7 @@
Source:
@@ -962,7 +962,7 @@
Source:
@@ -1022,7 +1022,7 @@
Source:
@@ -1152,7 +1152,7 @@
Source:
@@ -1272,7 +1272,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -1395,7 +1395,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -1560,7 +1560,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -1653,7 +1653,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -1722,7 +1722,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -1846,7 +1846,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -1988,7 +1988,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -2139,7 +2139,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -2281,7 +2281,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -2469,7 +2469,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -2607,7 +2607,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -2706,7 +2706,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -2875,7 +2875,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -3093,7 +3093,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -3182,7 +3182,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -3328,7 +3328,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -3451,7 +3451,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -3593,7 +3593,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -3758,7 +3758,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -3900,7 +3900,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -3997,7 +3997,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -4120,7 +4120,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -4310,7 +4310,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -4502,7 +4502,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -4651,7 +4651,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -4781,7 +4781,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -4911,7 +4911,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -5041,7 +5041,7 @@ value will be set to 0 so that it doesn't interfere with the envelope

Source:
@@ -5091,7 +5091,7 @@ value will be set to 0 so that it doesn't interfere with the envelope


- Documentation generated on Mon Jun 23 2014 14:51:32 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:11 GMT-0400 (EDT). diff --git a/doc/Tone.FeedbackDelay.html b/doc/Tone.FeedbackDelay.html index da057737..46850178 100644 --- a/doc/Tone.FeedbackDelay.html +++ b/doc/Tone.FeedbackDelay.html @@ -266,7 +266,7 @@
Source:
@@ -352,7 +352,7 @@
Source:
@@ -416,7 +416,7 @@
Source:
@@ -485,7 +485,7 @@
Source:
@@ -554,7 +554,7 @@
Source:
@@ -623,7 +623,7 @@
Source:
@@ -692,7 +692,7 @@
Source:
@@ -761,7 +761,7 @@
Source:
@@ -830,7 +830,7 @@
Source:
@@ -900,7 +900,7 @@
Source:
@@ -1034,7 +1034,7 @@
Source:
@@ -1163,7 +1163,7 @@
Source:
@@ -1286,7 +1286,7 @@
Source:
@@ -1409,7 +1409,7 @@
Source:
@@ -1574,7 +1574,7 @@
Source:
@@ -1667,7 +1667,7 @@
Source:
@@ -1736,7 +1736,7 @@
Source:
@@ -1860,7 +1860,7 @@
Source:
@@ -2002,7 +2002,7 @@
Source:
@@ -2153,7 +2153,7 @@
Source:
@@ -2295,7 +2295,7 @@
Source:
@@ -2483,7 +2483,7 @@
Source:
@@ -2621,7 +2621,7 @@
Source:
@@ -2720,7 +2720,7 @@
Source:
@@ -2889,7 +2889,7 @@
Source:
@@ -3107,7 +3107,7 @@
Source:
@@ -3196,7 +3196,7 @@
Source:
@@ -3342,7 +3342,7 @@
Source:
@@ -3465,7 +3465,7 @@
Source:
@@ -3607,7 +3607,7 @@
Source:
@@ -3772,7 +3772,7 @@
Source:
@@ -3952,7 +3952,7 @@
Source:
@@ -4119,7 +4119,7 @@ dryness is 0 (100% wet) to 1 (100% dry)

Source:
@@ -4286,7 +4286,7 @@ dryness is 0 (100% wet) to 1 (100% dry)

Source:
@@ -4453,7 +4453,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4576,7 +4576,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4673,7 +4673,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4796,7 +4796,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4986,7 +4986,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -5178,7 +5178,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -5247,7 +5247,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)


- Documentation generated on Mon Jun 23 2014 14:51:32 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:11 GMT-0400 (EDT). diff --git a/doc/Tone.FeedbackEffect.html b/doc/Tone.FeedbackEffect.html index 825ed67d..0713d67b 100644 --- a/doc/Tone.FeedbackEffect.html +++ b/doc/Tone.FeedbackEffect.html @@ -266,7 +266,7 @@
Source:
@@ -367,7 +367,7 @@
Source:
@@ -436,7 +436,7 @@
Source:
@@ -505,7 +505,7 @@
Source:
@@ -569,7 +569,7 @@
Source:
@@ -638,7 +638,7 @@
Source:
@@ -707,7 +707,7 @@
Source:
@@ -777,7 +777,7 @@
Source:
@@ -911,7 +911,7 @@
Source:
@@ -1040,7 +1040,7 @@
Source:
@@ -1163,7 +1163,7 @@
Source:
@@ -1286,7 +1286,7 @@
Source:
@@ -1451,7 +1451,7 @@
Source:
@@ -1544,7 +1544,7 @@
Source:
@@ -1613,7 +1613,7 @@
Source:
@@ -1737,7 +1737,7 @@
Source:
@@ -1879,7 +1879,7 @@
Source:
@@ -2030,7 +2030,7 @@
Source:
@@ -2172,7 +2172,7 @@
Source:
@@ -2360,7 +2360,7 @@
Source:
@@ -2498,7 +2498,7 @@
Source:
@@ -2597,7 +2597,7 @@
Source:
@@ -2766,7 +2766,7 @@
Source:
@@ -2984,7 +2984,7 @@
Source:
@@ -3073,7 +3073,7 @@
Source:
@@ -3219,7 +3219,7 @@
Source:
@@ -3342,7 +3342,7 @@
Source:
@@ -3484,7 +3484,7 @@
Source:
@@ -3649,7 +3649,7 @@
Source:
@@ -3835,7 +3835,7 @@ dryness is 0 (100% wet) to 1 (100% dry)

Source:
@@ -3997,7 +3997,7 @@ dryness is 0 (100% wet) to 1 (100% dry)

Source:
@@ -4164,7 +4164,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4287,7 +4287,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4384,7 +4384,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4507,7 +4507,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4697,7 +4697,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4889,7 +4889,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)

Source:
@@ -4958,7 +4958,7 @@ wetVal is 0 (100% dry) to 1 (100% wet)


- Documentation generated on Mon Jun 23 2014 14:51:33 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:11 GMT-0400 (EDT). diff --git a/doc/Tone.LFO.html b/doc/Tone.LFO.html index d5a57da7..47b9036a 100644 --- a/doc/Tone.LFO.html +++ b/doc/Tone.LFO.html @@ -333,7 +333,7 @@
Source:
@@ -420,7 +420,7 @@
Source:
@@ -480,7 +480,7 @@
Source:
@@ -540,7 +540,7 @@
Source:
@@ -594,7 +594,7 @@
Source:
@@ -724,7 +724,7 @@
Source:
@@ -847,7 +847,7 @@
Source:
@@ -1012,7 +1012,7 @@
Source:
@@ -1105,7 +1105,7 @@
Source:
@@ -1174,7 +1174,7 @@
Source:
@@ -1298,7 +1298,7 @@
Source:
@@ -1440,7 +1440,7 @@
Source:
@@ -1591,7 +1591,7 @@
Source:
@@ -1733,7 +1733,7 @@
Source:
@@ -1921,7 +1921,7 @@
Source:
@@ -2059,7 +2059,7 @@
Source:
@@ -2158,7 +2158,7 @@
Source:
@@ -2327,7 +2327,7 @@
Source:
@@ -2545,7 +2545,7 @@
Source:
@@ -2634,7 +2634,7 @@
Source:
@@ -2780,7 +2780,7 @@
Source:
@@ -2903,7 +2903,7 @@
Source:
@@ -3045,7 +3045,7 @@
Source:
@@ -3210,7 +3210,7 @@
Source:
@@ -3347,7 +3347,7 @@
Source:
@@ -3465,7 +3465,7 @@
Source:
@@ -3583,7 +3583,7 @@
Source:
@@ -3701,7 +3701,7 @@
Source:
@@ -3819,7 +3819,7 @@
Source:
@@ -3937,7 +3937,7 @@
Source:
@@ -4007,7 +4007,7 @@
Source:
@@ -4130,7 +4130,7 @@
Source:
@@ -4227,7 +4227,7 @@
Source:
@@ -4350,7 +4350,7 @@
Source:
@@ -4540,7 +4540,7 @@
Source:
@@ -4732,7 +4732,7 @@
Source:
@@ -4820,7 +4820,7 @@
Source:
@@ -4870,7 +4870,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:33 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:12 GMT-0400 (EDT). diff --git a/doc/Tone.Merge.html b/doc/Tone.Merge.html index 74b189f5..3f8e38c1 100644 --- a/doc/Tone.Merge.html +++ b/doc/Tone.Merge.html @@ -207,7 +207,7 @@
Source:
@@ -308,7 +308,7 @@
Source:
@@ -373,7 +373,7 @@
Source:
@@ -437,7 +437,7 @@
Source:
@@ -506,7 +506,7 @@
Source:
@@ -570,7 +570,7 @@
Source:
@@ -700,7 +700,7 @@
Source:
@@ -829,7 +829,7 @@
Source:
@@ -952,7 +952,7 @@
Source:
@@ -1117,7 +1117,7 @@
Source:
@@ -1210,7 +1210,7 @@
Source:
@@ -1279,7 +1279,7 @@
Source:
@@ -1403,7 +1403,7 @@
Source:
@@ -1545,7 +1545,7 @@
Source:
@@ -1696,7 +1696,7 @@
Source:
@@ -1838,7 +1838,7 @@
Source:
@@ -2026,7 +2026,7 @@
Source:
@@ -2164,7 +2164,7 @@
Source:
@@ -2263,7 +2263,7 @@
Source:
@@ -2432,7 +2432,7 @@
Source:
@@ -2650,7 +2650,7 @@
Source:
@@ -2739,7 +2739,7 @@
Source:
@@ -2885,7 +2885,7 @@
Source:
@@ -3008,7 +3008,7 @@
Source:
@@ -3150,7 +3150,7 @@
Source:
@@ -3315,7 +3315,7 @@
Source:
@@ -3457,7 +3457,7 @@
Source:
@@ -3554,7 +3554,7 @@
Source:
@@ -3677,7 +3677,7 @@
Source:
@@ -3867,7 +3867,7 @@
Source:
@@ -4059,7 +4059,7 @@
Source:
@@ -4128,7 +4128,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:33 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:12 GMT-0400 (EDT). diff --git a/doc/Tone.Meter.html b/doc/Tone.Meter.html index 5079eed0..7ab1dec9 100644 --- a/doc/Tone.Meter.html +++ b/doc/Tone.Meter.html @@ -336,7 +336,7 @@
Source:
@@ -428,7 +428,7 @@
Source:
@@ -488,7 +488,7 @@
Source:
@@ -557,7 +557,7 @@
Source:
@@ -626,7 +626,7 @@
Source:
@@ -686,7 +686,7 @@
Source:
@@ -816,7 +816,7 @@
Source:
@@ -945,7 +945,7 @@
Source:
@@ -1068,7 +1068,7 @@
Source:
@@ -1233,7 +1233,7 @@
Source:
@@ -1326,7 +1326,7 @@
Source:
@@ -1391,7 +1391,7 @@
Source:
@@ -1515,7 +1515,7 @@
Source:
@@ -1657,7 +1657,7 @@
Source:
@@ -1808,7 +1808,7 @@
Source:
@@ -1950,7 +1950,7 @@
Source:
@@ -2099,7 +2099,7 @@
Source:
@@ -2248,7 +2248,7 @@
Source:
@@ -2401,7 +2401,7 @@
Source:
@@ -2589,7 +2589,7 @@
Source:
@@ -2727,7 +2727,7 @@
Source:
@@ -2826,7 +2826,7 @@
Source:
@@ -2995,7 +2995,7 @@
Source:
@@ -3213,7 +3213,7 @@
Source:
@@ -3302,7 +3302,7 @@
Source:
@@ -3448,7 +3448,7 @@
Source:
@@ -3571,7 +3571,7 @@
Source:
@@ -3713,7 +3713,7 @@
Source:
@@ -3878,7 +3878,7 @@
Source:
@@ -4020,7 +4020,7 @@
Source:
@@ -4117,7 +4117,7 @@
Source:
@@ -4240,7 +4240,7 @@
Source:
@@ -4430,7 +4430,7 @@
Source:
@@ -4622,7 +4622,7 @@
Source:
@@ -4691,7 +4691,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:33 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:12 GMT-0400 (EDT). diff --git a/doc/Tone.Microphone.html b/doc/Tone.Microphone.html index 96ac6aba..d21ef89b 100644 --- a/doc/Tone.Microphone.html +++ b/doc/Tone.Microphone.html @@ -268,7 +268,7 @@
Source:
@@ -369,7 +369,7 @@
Source:
@@ -438,7 +438,7 @@
Source:
@@ -503,7 +503,7 @@
Source:
@@ -633,7 +633,7 @@
Source:
@@ -762,7 +762,7 @@
Source:
@@ -885,7 +885,7 @@
Source:
@@ -1050,7 +1050,7 @@
Source:
@@ -1143,7 +1143,7 @@
Source:
@@ -1212,7 +1212,7 @@
Source:
@@ -1336,7 +1336,7 @@
Source:
@@ -1478,7 +1478,7 @@
Source:
@@ -1629,7 +1629,7 @@
Source:
@@ -1771,7 +1771,7 @@
Source:
@@ -1959,7 +1959,7 @@
Source:
@@ -2097,7 +2097,7 @@
Source:
@@ -2196,7 +2196,7 @@
Source:
@@ -2365,7 +2365,7 @@
Source:
@@ -2583,7 +2583,7 @@
Source:
@@ -2672,7 +2672,7 @@
Source:
@@ -2814,7 +2814,7 @@
Source:
@@ -2937,7 +2937,7 @@
Source:
@@ -3060,7 +3060,7 @@
Source:
@@ -3202,7 +3202,7 @@
Source:
@@ -3367,7 +3367,7 @@
Source:
@@ -3548,7 +3548,7 @@
Source:
@@ -3617,7 +3617,7 @@
Source:
@@ -3686,7 +3686,7 @@
Source:
@@ -3760,7 +3760,7 @@
Source:
@@ -3883,7 +3883,7 @@
Source:
@@ -3980,7 +3980,7 @@
Source:
@@ -4103,7 +4103,7 @@
Source:
@@ -4293,7 +4293,7 @@
Source:
@@ -4485,7 +4485,7 @@
Source:
@@ -4578,7 +4578,7 @@
Source:
@@ -4628,7 +4628,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:33 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:12 GMT-0400 (EDT). diff --git a/doc/Tone.Multiply.html b/doc/Tone.Multiply.html index 733eb9e6..01ba9f63 100644 --- a/doc/Tone.Multiply.html +++ b/doc/Tone.Multiply.html @@ -266,7 +266,7 @@
Source:
@@ -363,7 +363,7 @@
Source:
@@ -423,7 +423,7 @@
Source:
@@ -553,7 +553,7 @@
Source:
@@ -682,7 +682,7 @@
Source:
@@ -805,7 +805,7 @@
Source:
@@ -970,7 +970,7 @@
Source:
@@ -1063,7 +1063,7 @@
Source:
@@ -1132,7 +1132,7 @@
Source:
@@ -1256,7 +1256,7 @@
Source:
@@ -1398,7 +1398,7 @@
Source:
@@ -1549,7 +1549,7 @@
Source:
@@ -1691,7 +1691,7 @@
Source:
@@ -1879,7 +1879,7 @@
Source:
@@ -2017,7 +2017,7 @@
Source:
@@ -2116,7 +2116,7 @@
Source:
@@ -2285,7 +2285,7 @@
Source:
@@ -2503,7 +2503,7 @@
Source:
@@ -2592,7 +2592,7 @@
Source:
@@ -2738,7 +2738,7 @@
Source:
@@ -2861,7 +2861,7 @@
Source:
@@ -3003,7 +3003,7 @@
Source:
@@ -3168,7 +3168,7 @@
Source:
@@ -3305,7 +3305,7 @@
Source:
@@ -3428,7 +3428,7 @@
Source:
@@ -3525,7 +3525,7 @@
Source:
@@ -3648,7 +3648,7 @@
Source:
@@ -3838,7 +3838,7 @@
Source:
@@ -4030,7 +4030,7 @@
Source:
@@ -4099,7 +4099,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:34 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:12 GMT-0400 (EDT). diff --git a/doc/Tone.Noise.html b/doc/Tone.Noise.html index f2202d0c..3f6eb99c 100644 --- a/doc/Tone.Noise.html +++ b/doc/Tone.Noise.html @@ -255,7 +255,7 @@
Source:
@@ -356,7 +356,7 @@
Source:
@@ -425,7 +425,7 @@
Source:
@@ -490,7 +490,7 @@
Source:
@@ -620,7 +620,7 @@
Source:
@@ -749,7 +749,7 @@
Source:
@@ -872,7 +872,7 @@
Source:
@@ -1037,7 +1037,7 @@
Source:
@@ -1130,7 +1130,7 @@
Source:
@@ -1199,7 +1199,7 @@
Source:
@@ -1323,7 +1323,7 @@
Source:
@@ -1465,7 +1465,7 @@
Source:
@@ -1616,7 +1616,7 @@
Source:
@@ -1758,7 +1758,7 @@
Source:
@@ -1946,7 +1946,7 @@
Source:
@@ -2084,7 +2084,7 @@
Source:
@@ -2183,7 +2183,7 @@
Source:
@@ -2352,7 +2352,7 @@
Source:
@@ -2570,7 +2570,7 @@
Source:
@@ -2659,7 +2659,7 @@
Source:
@@ -2751,7 +2751,7 @@
Source:
@@ -2870,7 +2870,7 @@
Source:
@@ -2993,7 +2993,7 @@
Source:
@@ -3116,7 +3116,7 @@
Source:
@@ -3258,7 +3258,7 @@
Source:
@@ -3423,7 +3423,7 @@
Source:
@@ -3583,7 +3583,7 @@
Source:
@@ -3745,7 +3745,7 @@
Source:
@@ -3863,7 +3863,7 @@
Source:
@@ -3981,7 +3981,7 @@
Source:
@@ -4055,7 +4055,7 @@
Source:
@@ -4178,7 +4178,7 @@
Source:
@@ -4275,7 +4275,7 @@
Source:
@@ -4398,7 +4398,7 @@
Source:
@@ -4588,7 +4588,7 @@
Source:
@@ -4780,7 +4780,7 @@
Source:
@@ -4873,7 +4873,7 @@
Source:
@@ -4923,7 +4923,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:34 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:12 GMT-0400 (EDT). diff --git a/doc/Tone.Oscillator.html b/doc/Tone.Oscillator.html index 8a0fcf71..771420da 100644 --- a/doc/Tone.Oscillator.html +++ b/doc/Tone.Oscillator.html @@ -301,7 +301,7 @@
Source:
@@ -397,7 +397,7 @@
Source:
@@ -466,7 +466,7 @@
Source:
@@ -530,7 +530,7 @@
Source:
@@ -599,7 +599,7 @@
Source:
@@ -664,7 +664,7 @@
Source:
@@ -794,7 +794,7 @@
Source:
@@ -923,7 +923,7 @@
Source:
@@ -1046,7 +1046,7 @@
Source:
@@ -1211,7 +1211,7 @@
Source:
@@ -1304,7 +1304,7 @@
Source:
@@ -1373,7 +1373,7 @@
Source:
@@ -1497,7 +1497,7 @@
Source:
@@ -1639,7 +1639,7 @@
Source:
@@ -1790,7 +1790,7 @@
Source:
@@ -1932,7 +1932,7 @@
Source:
@@ -2120,7 +2120,7 @@
Source:
@@ -2258,7 +2258,7 @@
Source:
@@ -2357,7 +2357,7 @@
Source:
@@ -2526,7 +2526,7 @@
Source:
@@ -2744,7 +2744,7 @@
Source:
@@ -2833,7 +2833,7 @@
Source:
@@ -2921,7 +2921,7 @@
Source:
@@ -3040,7 +3040,7 @@
Source:
@@ -3163,7 +3163,7 @@
Source:
@@ -3286,7 +3286,7 @@
Source:
@@ -3428,7 +3428,7 @@
Source:
@@ -3593,7 +3593,7 @@
Source:
@@ -3773,7 +3773,7 @@
Source:
@@ -3891,7 +3891,7 @@
Source:
@@ -4053,7 +4053,7 @@
Source:
@@ -4171,7 +4171,7 @@
Source:
@@ -4301,7 +4301,7 @@
Source:
@@ -4374,7 +4374,7 @@
Source:
@@ -4497,7 +4497,7 @@
Source:
@@ -4594,7 +4594,7 @@
Source:
@@ -4717,7 +4717,7 @@
Source:
@@ -4907,7 +4907,7 @@
Source:
@@ -5099,7 +5099,7 @@
Source:
@@ -5187,7 +5187,7 @@
Source:
@@ -5237,7 +5237,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:34 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:13 GMT-0400 (EDT). diff --git a/doc/Tone.Panner.html b/doc/Tone.Panner.html index 809d4b1c..bf2aed01 100644 --- a/doc/Tone.Panner.html +++ b/doc/Tone.Panner.html @@ -270,7 +270,7 @@
Source:
@@ -371,7 +371,7 @@
Source:
@@ -440,7 +440,7 @@
Source:
@@ -504,7 +504,7 @@
Source:
@@ -634,7 +634,7 @@
Source:
@@ -763,7 +763,7 @@
Source:
@@ -886,7 +886,7 @@
Source:
@@ -1051,7 +1051,7 @@
Source:
@@ -1144,7 +1144,7 @@
Source:
@@ -1213,7 +1213,7 @@
Source:
@@ -1337,7 +1337,7 @@
Source:
@@ -1479,7 +1479,7 @@
Source:
@@ -1630,7 +1630,7 @@
Source:
@@ -1772,7 +1772,7 @@
Source:
@@ -1960,7 +1960,7 @@
Source:
@@ -2098,7 +2098,7 @@
Source:
@@ -2197,7 +2197,7 @@
Source:
@@ -2366,7 +2366,7 @@
Source:
@@ -2584,7 +2584,7 @@
Source:
@@ -2673,7 +2673,7 @@
Source:
@@ -2819,7 +2819,7 @@
Source:
@@ -2942,7 +2942,7 @@
Source:
@@ -3084,7 +3084,7 @@
Source:
@@ -3249,7 +3249,7 @@
Source:
@@ -3431,7 +3431,7 @@
Source:
@@ -3554,7 +3554,7 @@
Source:
@@ -3651,7 +3651,7 @@
Source:
@@ -3774,7 +3774,7 @@
Source:
@@ -3964,7 +3964,7 @@
Source:
@@ -4156,7 +4156,7 @@
Source:
@@ -4225,7 +4225,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:34 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:13 GMT-0400 (EDT). diff --git a/doc/Tone.PingPongDelay.html b/doc/Tone.PingPongDelay.html index a24123f6..958bb03d 100644 --- a/doc/Tone.PingPongDelay.html +++ b/doc/Tone.PingPongDelay.html @@ -266,7 +266,7 @@
Source:
@@ -352,7 +352,7 @@
Source:
@@ -421,7 +421,7 @@
Source:
@@ -490,7 +490,7 @@
Source:
@@ -559,7 +559,7 @@
Source:
@@ -628,7 +628,7 @@
Source:
@@ -692,7 +692,7 @@
Source:
@@ -761,7 +761,7 @@
Source:
@@ -821,7 +821,7 @@
Source:
@@ -891,7 +891,7 @@
Source:
@@ -1025,7 +1025,7 @@
Source:
@@ -1154,7 +1154,7 @@
Source:
@@ -1277,7 +1277,7 @@
Source:
@@ -1400,7 +1400,7 @@
Source:
@@ -1565,7 +1565,7 @@
Source:
@@ -1658,7 +1658,7 @@
Source:
@@ -1732,7 +1732,7 @@
Source:
@@ -1856,7 +1856,7 @@
Source:
@@ -1998,7 +1998,7 @@
Source:
@@ -2149,7 +2149,7 @@
Source:
@@ -2291,7 +2291,7 @@
Source:
@@ -2479,7 +2479,7 @@
Source:
@@ -2617,7 +2617,7 @@
Source:
@@ -2716,7 +2716,7 @@
Source:
@@ -2885,7 +2885,7 @@
Source:
@@ -3103,7 +3103,7 @@
Source:
@@ -3192,7 +3192,7 @@
Source:
@@ -3338,7 +3338,7 @@
Source:
@@ -3461,7 +3461,7 @@
Source:
@@ -3603,7 +3603,7 @@
Source:
@@ -3768,7 +3768,7 @@
Source:
@@ -3905,7 +3905,7 @@
Source:
@@ -4023,7 +4023,7 @@
Source:
@@ -4141,7 +4141,7 @@
Source:
@@ -4259,7 +4259,7 @@
Source:
@@ -4382,7 +4382,7 @@
Source:
@@ -4479,7 +4479,7 @@
Source:
@@ -4602,7 +4602,7 @@
Source:
@@ -4792,7 +4792,7 @@
Source:
@@ -4984,7 +4984,7 @@
Source:
@@ -5053,7 +5053,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:34 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:13 GMT-0400 (EDT). diff --git a/doc/Tone.Player.html b/doc/Tone.Player.html index 7ef6ab40..21713730 100644 --- a/doc/Tone.Player.html +++ b/doc/Tone.Player.html @@ -303,7 +303,7 @@
Source:
@@ -399,7 +399,7 @@
Source:
@@ -468,7 +468,7 @@
Source:
@@ -537,7 +537,7 @@
Source:
@@ -602,7 +602,7 @@
Source:
@@ -667,7 +667,7 @@
Source:
@@ -797,7 +797,7 @@
Source:
@@ -926,7 +926,7 @@
Source:
@@ -1049,7 +1049,7 @@
Source:
@@ -1214,7 +1214,7 @@
Source:
@@ -1307,7 +1307,7 @@
Source:
@@ -1376,7 +1376,7 @@
Source:
@@ -1500,7 +1500,7 @@
Source:
@@ -1642,7 +1642,7 @@
Source:
@@ -1793,7 +1793,7 @@
Source:
@@ -1935,7 +1935,7 @@
Source:
@@ -2123,7 +2123,7 @@
Source:
@@ -2308,7 +2308,7 @@
Source:
@@ -2427,7 +2427,7 @@
Source:
@@ -2712,7 +2712,7 @@
Source:
@@ -2788,7 +2788,7 @@
Source:
@@ -2957,7 +2957,7 @@
Source:
@@ -3175,7 +3175,7 @@
Source:
@@ -3264,7 +3264,7 @@
Source:
@@ -3356,7 +3356,7 @@
Source:
@@ -3475,7 +3475,7 @@
Source:
@@ -3598,7 +3598,7 @@
Source:
@@ -3721,7 +3721,7 @@
Source:
@@ -3863,7 +3863,7 @@
Source:
@@ -4028,7 +4028,7 @@
Source:
@@ -4169,7 +4169,7 @@
Source:
@@ -4331,7 +4331,7 @@
Source:
@@ -4493,7 +4493,7 @@
Source:
@@ -4689,7 +4689,7 @@
Source:
@@ -4807,7 +4807,7 @@
Source:
@@ -4881,7 +4881,7 @@
Source:
@@ -5004,7 +5004,7 @@
Source:
@@ -5101,7 +5101,7 @@
Source:
@@ -5224,7 +5224,7 @@
Source:
@@ -5414,7 +5414,7 @@
Source:
@@ -5606,7 +5606,7 @@
Source:
@@ -5699,7 +5699,7 @@
Source:
@@ -5749,7 +5749,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:34 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:13 GMT-0400 (EDT). diff --git a/doc/Tone.Recorder.html b/doc/Tone.Recorder.html index b4a54567..f825342d 100644 --- a/doc/Tone.Recorder.html +++ b/doc/Tone.Recorder.html @@ -255,7 +255,7 @@
Source:
@@ -351,7 +351,7 @@
Source:
@@ -420,7 +420,7 @@
Source:
@@ -489,7 +489,7 @@
Source:
@@ -549,7 +549,7 @@
Source:
@@ -679,7 +679,7 @@
Source:
@@ -748,7 +748,7 @@
Source:
@@ -877,7 +877,7 @@
Source:
@@ -1000,7 +1000,7 @@
Source:
@@ -1165,7 +1165,7 @@
Source:
@@ -1258,7 +1258,7 @@
Source:
@@ -1327,7 +1327,7 @@
Source:
@@ -1451,7 +1451,7 @@
Source:
@@ -1593,7 +1593,7 @@
Source:
@@ -1744,7 +1744,7 @@
Source:
@@ -1886,7 +1886,7 @@
Source:
@@ -1970,7 +1970,7 @@
Source:
@@ -2054,7 +2054,7 @@
Source:
@@ -2242,7 +2242,7 @@
Source:
@@ -2330,7 +2330,7 @@
Source:
@@ -2468,7 +2468,7 @@
Source:
@@ -2567,7 +2567,7 @@
Source:
@@ -2736,7 +2736,7 @@
Source:
@@ -2954,7 +2954,7 @@
Source:
@@ -3043,7 +3043,7 @@
Source:
@@ -3189,7 +3189,7 @@
Source:
@@ -3354,7 +3354,7 @@
Source:
@@ -3477,7 +3477,7 @@
Source:
@@ -3619,7 +3619,7 @@
Source:
@@ -3784,7 +3784,7 @@
Source:
@@ -3926,7 +3926,7 @@
Source:
@@ -4023,7 +4023,7 @@
Source:
@@ -4146,7 +4146,7 @@
Source:
@@ -4336,7 +4336,7 @@
Source:
@@ -4528,7 +4528,7 @@
Source:
@@ -4597,7 +4597,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:35 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:13 GMT-0400 (EDT). diff --git a/doc/Tone.Scale.html b/doc/Tone.Scale.html index e6ebcf0c..5dda39fb 100644 --- a/doc/Tone.Scale.html +++ b/doc/Tone.Scale.html @@ -364,7 +364,7 @@
Source:
@@ -465,7 +465,7 @@
Source:
@@ -534,7 +534,7 @@
Source:
@@ -664,7 +664,7 @@
Source:
@@ -793,7 +793,7 @@
Source:
@@ -916,7 +916,7 @@
Source:
@@ -1081,7 +1081,7 @@
Source:
@@ -1174,7 +1174,7 @@
Source:
@@ -1243,7 +1243,7 @@
Source:
@@ -1367,7 +1367,7 @@
Source:
@@ -1509,7 +1509,7 @@
Source:
@@ -1660,7 +1660,7 @@
Source:
@@ -1802,7 +1802,7 @@
Source:
@@ -1990,7 +1990,7 @@
Source:
@@ -2128,7 +2128,7 @@
Source:
@@ -2227,7 +2227,7 @@
Source:
@@ -2396,7 +2396,7 @@
Source:
@@ -2614,7 +2614,7 @@
Source:
@@ -2703,7 +2703,7 @@
Source:
@@ -2849,7 +2849,7 @@
Source:
@@ -2972,7 +2972,7 @@
Source:
@@ -3114,7 +3114,7 @@
Source:
@@ -3279,7 +3279,7 @@
Source:
@@ -3416,7 +3416,7 @@
Source:
@@ -3534,7 +3534,7 @@
Source:
@@ -3652,7 +3652,7 @@
Source:
@@ -3770,7 +3770,7 @@
Source:
@@ -3893,7 +3893,7 @@
Source:
@@ -3990,7 +3990,7 @@
Source:
@@ -4113,7 +4113,7 @@
Source:
@@ -4303,7 +4303,7 @@
Source:
@@ -4495,7 +4495,7 @@
Source:
@@ -4564,7 +4564,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:35 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:14 GMT-0400 (EDT). diff --git a/doc/Tone.Signal.html b/doc/Tone.Signal.html index 76ed3e95..5bcea417 100644 --- a/doc/Tone.Signal.html +++ b/doc/Tone.Signal.html @@ -272,7 +272,7 @@
Source:
@@ -373,7 +373,7 @@
Source:
@@ -442,7 +442,7 @@
Source:
@@ -506,7 +506,7 @@
Source:
@@ -621,7 +621,7 @@
Source:
@@ -755,7 +755,7 @@
Source:
@@ -882,7 +882,7 @@
Source:
@@ -1005,7 +1005,7 @@
Source:
@@ -1170,7 +1170,7 @@
Source:
@@ -1263,7 +1263,7 @@
Source:
@@ -1332,7 +1332,7 @@
Source:
@@ -1456,7 +1456,7 @@
Source:
@@ -1623,7 +1623,7 @@
Source:
@@ -1765,7 +1765,7 @@
Source:
@@ -1884,7 +1884,7 @@
Source:
@@ -2035,7 +2035,7 @@
Source:
@@ -2177,7 +2177,7 @@
Source:
@@ -2261,7 +2261,7 @@
Source:
@@ -2453,7 +2453,7 @@
Source:
@@ -2614,7 +2614,7 @@
Source:
@@ -2756,7 +2756,7 @@
Source:
@@ -2875,7 +2875,7 @@
Source:
@@ -2974,7 +2974,7 @@
Source:
@@ -3143,7 +3143,7 @@
Source:
@@ -3361,7 +3361,7 @@
Source:
@@ -3450,7 +3450,7 @@
Source:
@@ -3596,7 +3596,7 @@
Source:
@@ -3719,7 +3719,7 @@
Source:
@@ -3861,7 +3861,7 @@
Source:
@@ -4026,7 +4026,7 @@
Source:
@@ -4175,7 +4175,7 @@
Source:
@@ -4363,7 +4363,7 @@
Source:
@@ -4482,7 +4482,7 @@
Source:
@@ -4623,7 +4623,7 @@
Source:
@@ -4788,7 +4788,7 @@
Source:
@@ -4954,7 +4954,7 @@
Source:
@@ -5077,7 +5077,7 @@
Source:
@@ -5174,7 +5174,7 @@
Source:
@@ -5297,7 +5297,7 @@
Source:
@@ -5487,7 +5487,7 @@
Source:
@@ -5679,7 +5679,7 @@
Source:
@@ -5768,7 +5768,7 @@
Source:
@@ -5818,7 +5818,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:35 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:14 GMT-0400 (EDT). diff --git a/doc/Tone.Source.html b/doc/Tone.Source.html index 9be92dc2..a922592f 100644 --- a/doc/Tone.Source.html +++ b/doc/Tone.Source.html @@ -208,7 +208,7 @@
Source:
@@ -447,7 +447,7 @@
Source:
@@ -516,7 +516,7 @@
Source:
@@ -580,7 +580,7 @@
Source:
@@ -640,7 +640,7 @@
Source:
@@ -770,7 +770,7 @@
Source:
@@ -899,7 +899,7 @@
Source:
@@ -1022,7 +1022,7 @@
Source:
@@ -1187,7 +1187,7 @@
Source:
@@ -1280,7 +1280,7 @@
Source:
@@ -1354,7 +1354,7 @@
Source:
@@ -1478,7 +1478,7 @@
Source:
@@ -1620,7 +1620,7 @@
Source:
@@ -1771,7 +1771,7 @@
Source:
@@ -1913,7 +1913,7 @@
Source:
@@ -2101,7 +2101,7 @@
Source:
@@ -2239,7 +2239,7 @@
Source:
@@ -2338,7 +2338,7 @@
Source:
@@ -2507,7 +2507,7 @@
Source:
@@ -2725,7 +2725,7 @@
Source:
@@ -2814,7 +2814,7 @@
Source:
@@ -2951,7 +2951,7 @@
Source:
@@ -3074,7 +3074,7 @@
Source:
@@ -3197,7 +3197,7 @@
Source:
@@ -3339,7 +3339,7 @@
Source:
@@ -3504,7 +3504,7 @@
Source:
@@ -3680,7 +3680,7 @@
Source:
@@ -3794,7 +3794,7 @@
Source:
@@ -3908,7 +3908,7 @@
Source:
@@ -3977,7 +3977,7 @@
Source:
@@ -4100,7 +4100,7 @@
Source:
@@ -4197,7 +4197,7 @@
Source:
@@ -4320,7 +4320,7 @@
Source:
@@ -4510,7 +4510,7 @@
Source:
@@ -4702,7 +4702,7 @@
Source:
@@ -4790,7 +4790,7 @@
Source:
@@ -4840,7 +4840,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:35 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:14 GMT-0400 (EDT). diff --git a/doc/Tone.Split.html b/doc/Tone.Split.html index ad30dc60..1064f5ac 100644 --- a/doc/Tone.Split.html +++ b/doc/Tone.Split.html @@ -206,7 +206,7 @@
Source:
@@ -307,7 +307,7 @@
Source:
@@ -371,7 +371,7 @@
Source:
@@ -440,7 +440,7 @@
Source:
@@ -504,7 +504,7 @@
Source:
@@ -564,7 +564,7 @@
Source:
@@ -694,7 +694,7 @@
Source:
@@ -823,7 +823,7 @@
Source:
@@ -946,7 +946,7 @@
Source:
@@ -1111,7 +1111,7 @@
Source:
@@ -1204,7 +1204,7 @@
Source:
@@ -1273,7 +1273,7 @@
Source:
@@ -1397,7 +1397,7 @@
Source:
@@ -1539,7 +1539,7 @@
Source:
@@ -1690,7 +1690,7 @@
Source:
@@ -1832,7 +1832,7 @@
Source:
@@ -2020,7 +2020,7 @@
Source:
@@ -2158,7 +2158,7 @@
Source:
@@ -2257,7 +2257,7 @@
Source:
@@ -2426,7 +2426,7 @@
Source:
@@ -2644,7 +2644,7 @@
Source:
@@ -2733,7 +2733,7 @@
Source:
@@ -2879,7 +2879,7 @@
Source:
@@ -3002,7 +3002,7 @@
Source:
@@ -3144,7 +3144,7 @@
Source:
@@ -3309,7 +3309,7 @@
Source:
@@ -3451,7 +3451,7 @@
Source:
@@ -3548,7 +3548,7 @@
Source:
@@ -3671,7 +3671,7 @@
Source:
@@ -3861,7 +3861,7 @@
Source:
@@ -4053,7 +4053,7 @@
Source:
@@ -4122,7 +4122,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:35 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:14 GMT-0400 (EDT). diff --git a/doc/Tone.Transport.html b/doc/Tone.Transport.html index 1b7c885f..4fe401fe 100644 --- a/doc/Tone.Transport.html +++ b/doc/Tone.Transport.html @@ -206,7 +206,7 @@
Source:
@@ -307,7 +307,7 @@
Source:
@@ -367,7 +367,7 @@
Source:
@@ -436,7 +436,7 @@
Source:
@@ -496,7 +496,7 @@
Source:
@@ -610,7 +610,7 @@
Source:
@@ -744,7 +744,7 @@
Source:
@@ -862,7 +862,7 @@
Source:
@@ -954,7 +954,7 @@
Source:
@@ -1072,7 +1072,7 @@
Source:
@@ -1164,7 +1164,7 @@
Source:
@@ -1282,7 +1282,7 @@
Source:
@@ -1374,7 +1374,7 @@
Source:
@@ -1510,7 +1510,7 @@
Source:
@@ -1633,7 +1633,7 @@
Source:
@@ -1798,7 +1798,7 @@
Source:
@@ -1891,7 +1891,7 @@
Source:
@@ -1965,7 +1965,7 @@
Source:
@@ -2089,7 +2089,7 @@
Source:
@@ -2231,7 +2231,7 @@
Source:
@@ -2382,7 +2382,7 @@
Source:
@@ -2524,7 +2524,7 @@
Source:
@@ -2612,7 +2612,7 @@
Source:
@@ -2702,7 +2702,7 @@
Source:
@@ -2790,7 +2790,7 @@
Source:
@@ -2982,7 +2982,7 @@
Source:
@@ -3120,7 +3120,7 @@
Source:
@@ -3219,7 +3219,7 @@
Source:
@@ -3388,7 +3388,7 @@
Source:
@@ -3606,7 +3606,7 @@
Source:
@@ -3695,7 +3695,7 @@
Source:
@@ -3836,7 +3836,7 @@
Source:
@@ -3959,7 +3959,7 @@
Source:
@@ -4082,7 +4082,7 @@
Source:
@@ -4224,7 +4224,7 @@
Source:
@@ -4389,7 +4389,7 @@
Source:
@@ -4570,7 +4570,7 @@
Source:
@@ -4734,7 +4734,7 @@
Source:
@@ -4875,7 +4875,7 @@
Source:
@@ -5016,7 +5016,7 @@
Source:
@@ -5134,7 +5134,7 @@
Source:
@@ -5300,7 +5300,7 @@
Source:
@@ -5487,7 +5487,7 @@
Source:
@@ -5671,7 +5671,7 @@
Source:
@@ -5797,7 +5797,7 @@
Source:
@@ -5915,7 +5915,7 @@
Source:
@@ -6033,7 +6033,7 @@
Source:
@@ -6156,7 +6156,7 @@
Source:
@@ -6253,7 +6253,7 @@
Source:
@@ -6376,7 +6376,7 @@
Source:
@@ -6566,7 +6566,7 @@
Source:
@@ -6758,7 +6758,7 @@
Source:
@@ -6895,7 +6895,7 @@
Source:
@@ -7032,7 +7032,7 @@
Source:
@@ -7082,7 +7082,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:36 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:14 GMT-0400 (EDT). diff --git a/doc/Tone.html b/doc/Tone.html index d27ab458..81f5e1f3 100644 --- a/doc/Tone.html +++ b/doc/Tone.html @@ -204,7 +204,7 @@
Source:
@@ -370,7 +370,7 @@
Source:
@@ -434,7 +434,7 @@
Source:
@@ -498,7 +498,7 @@
Source:
@@ -660,7 +660,7 @@
Source:
@@ -789,7 +789,7 @@
Source:
@@ -913,7 +913,7 @@
Source:
@@ -1031,7 +1031,7 @@
Source:
@@ -1191,7 +1191,7 @@
Source:
@@ -1279,7 +1279,7 @@
Source:
@@ -1348,7 +1348,7 @@
Source:
@@ -1467,7 +1467,7 @@
Source:
@@ -1604,7 +1604,7 @@
Source:
@@ -1750,7 +1750,7 @@
Source:
@@ -1887,7 +1887,7 @@
Source:
@@ -2070,7 +2070,7 @@
Source:
@@ -2203,7 +2203,7 @@
Source:
@@ -2297,7 +2297,7 @@
Source:
@@ -2461,7 +2461,7 @@
Source:
@@ -2674,7 +2674,7 @@
Source:
@@ -2758,7 +2758,7 @@
Source:
@@ -2899,7 +2899,7 @@
Source:
@@ -3017,7 +3017,7 @@
Source:
@@ -3154,7 +3154,7 @@
Source:
@@ -3314,7 +3314,7 @@
Source:
@@ -3451,7 +3451,7 @@
Source:
@@ -3543,7 +3543,7 @@
Source:
@@ -3661,7 +3661,7 @@
Source:
@@ -3846,7 +3846,7 @@
Source:
@@ -4033,7 +4033,7 @@
Source:
@@ -4102,7 +4102,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:31 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:10 GMT-0400 (EDT). diff --git a/doc/Tone.js.html b/doc/Tone.js.html index 0e08730e..f1e98bda 100644 --- a/doc/Tone.js.html +++ b/doc/Tone.js.html @@ -3,7 +3,7 @@ - Tone.js Source: core/Tone.js + Tone.js Source: Tone.js OscillatorA.frequency + * ^--> Tone.Multiply(2) --> OscillatorB.frequency + * + * + * Tone.Signal can be scheduled with all of the functions available to AudioParams + * + * + * @constructor + * @extends {Tone} + * @param {number=} value (optional) initial value + */ + Tone.Signal = function(value){ + + Tone.call(this); + + /** + * scales the constant output to the desired output + * @type {GainNode} + */ + this.scalar = this.context.createGain(); + /** + * the ratio of the this value to the control signal value + * + * @private + * @type {number} + */ + this._syncRatio = 1; + + //connect the constant 1 output to the node output + this.chain(constant, this.scalar, this.output); + //signal passes through + this.input.connect(this.output); + + //set the default value + this.setValue(this.defaultArg(value, 0)); + }; + + Tone.extend(Tone.Signal); + + /** + * @return {number} the current value of the signal + */ + Tone.Signal.prototype.getValue = function(){ + return this.scalar.gain.value; + }; + + /** + * set the value of the signal right away + * will be overwritten if there are previously scheduled automation curves + * + * @param {number} value + */ + Tone.Signal.prototype.setValue = function(value){ + if (this._syncRatio === 0){ + value = 0; + } else { + value *= this._syncRatio; + } + this.scalar.gain.value = value; + }; + + /** + * Schedules a parameter value change at the given time. + * + * @param {number} value + * @param {Tone.Time} time + */ + Tone.Signal.prototype.setValueAtTime = function(value, time){ + value *= this._syncRatio; + this.scalar.gain.setValueAtTime(value, this.toSeconds(time)); + }; + + /** + * creates a schedule point with the current value at the current time + * + * @param {number=} now (optionally) pass the now value in + * @returns {number} the current value + */ + Tone.Signal.prototype.setCurrentValueNow = function(now){ + now = this.defaultArg(now, this.now()); + var currentVal = this.getValue(); + this.cancelScheduledValues(now); + this.scalar.gain.setValueAtTime(currentVal, now); + return currentVal; + }; + + /** + * Schedules a linear continuous change in parameter value from the + * previous scheduled parameter value to the given value. + * + * @param {number} value + * @param {Tone.Time} endTime + */ + Tone.Signal.prototype.linearRampToValueAtTime = function(value, endTime){ + value *= this._syncRatio; + this.scalar.gain.linearRampToValueAtTime(value, this.toSeconds(endTime)); + }; + + /** + * Schedules an exponential continuous change in parameter value from + * the previous scheduled parameter value to the given value. + * + * NOTE: Chrome will throw an error if you try to exponentially ramp to a + * value 0 or less. + * + * @param {number} value + * @param {Tone.Time} endTime + */ + Tone.Signal.prototype.exponentialRampToValueAtTime = function(value, endTime){ + value *= this._syncRatio; + this.scalar.gain.exponentialRampToValueAtTime(value, this.toSeconds(endTime)); + }; + + /** + * Schedules an exponential continuous change in parameter value from + * the current time and current value to the given value. + * + * @param {number} value + * @param {Tone.Time} endTime + */ + Tone.Signal.prototype.exponentialRampToValueNow = function(value, endTime){ + var now = this.now(); + this.setCurrentValueNow(now); + value *= this._syncRatio; + //make sure that the endTime doesn't start with + + if (endTime.toString().charAt(0) === "+"){ + endTime = endTime.substr(1); + } + this.scalar.gain.exponentialRampToValueAtTime(value, now + this.toSeconds(endTime)); + }; + + /** + * Schedules an linear continuous change in parameter value from + * the current time and current value to the given value at the given time. + * + * @param {number} value + * @param {Tone.Time} endTime + */ + Tone.Signal.prototype.linearRampToValueNow = function(value, endTime){ + var now = this.now(); + this.setCurrentValueNow(now); + value *= this._syncRatio; + //make sure that the endTime doesn't start with + + if (endTime.toString().charAt(0) === "+"){ + endTime = endTime.substr(1); + } + this.scalar.gain.linearRampToValueAtTime(value, now + this.toSeconds(endTime)); + }; + + /** + * Start exponentially approaching the target value at the given time with + * a rate having the given time constant. + * + * @param {number} value + * @param {Tone.Time} startTime + * @param {number} timeConstant + */ + Tone.Signal.prototype.setTargetAtTime = function(value, startTime, timeConstant){ + value *= this._syncRatio; + this.output.gain.setTargetAtTime(value, this.toSeconds(startTime), timeConstant); + }; + + /** + * Sets an array of arbitrary parameter values starting at the given time + * for the given duration. + * + * @param {Array<number>} values + * @param {Tone.Time} startTime + * @param {Tone.Time} duration + */ + Tone.Signal.prototype.setValueCurveAtTime = function(values, startTime, duration){ + for (var i = 0; i < values.length; i++){ + values[i] *= this._syncRatio; + } + this.scalar.gain.setValueCurveAtTime(values, this.toSeconds(startTime), this.toSeconds(duration)); + }; + + /** + * Cancels all scheduled parameter changes with times greater than or + * equal to startTime. + * + * @param {Tone.Time} startTime + */ + Tone.Signal.prototype.cancelScheduledValues = function(startTime){ + this.scalar.gain.cancelScheduledValues(this.toSeconds(startTime)); + }; + + /** + * Sync this to another signal and it will always maintain the + * ratio between the two signals until it is unsynced + * + * Signals can only be synced to one other signal. while syncing, + * if a signal's value is changed, the new ratio between the signals + * is maintained as the syncing signal is changed. + * + * @param {Tone.Signal} signal to sync to + * @param {number=} ratio optionally pass in the ratio between + * the two signals, otherwise it will be computed + */ + Tone.Signal.prototype.sync = function(signal, ratio){ + if (ratio){ + this._syncRatio = ratio; + } else { + //get the sync ratio + if (signal.getValue() !== 0){ + this._syncRatio = this.getValue() / signal.getValue(); + } else { + this._syncRatio = 0; + } + } + //make a new scalar which is not connected to the constant signal + this.scalar.disconnect(); + this.scalar = this.context.createGain(); + this.chain(signal, this.scalar, this.output); + //set it ot the sync ratio + this.scalar.gain.value = this._syncRatio; + }; + + /** + * unbind the signal control + * + * will leave the signal value as it was without the influence of the control signal + */ + Tone.Signal.prototype.unsync = function(){ + //make a new scalar so that it's disconnected from the control signal + //get the current gain + var currentGain = this.getValue(); + this.scalar.disconnect(); + this.scalar = this.context.createGain(); + this.scalar.gain.value = currentGain / this._syncRatio; + this._syncRatio = 1; + //reconnect things up + this.chain(constant, this.scalar, this.output); + }; + + /** + * internal dispose method to tear down the node + */ + Tone.Signal.prototype.dispose = function(){ + //disconnect everything + this.output.disconnect(); + this.scalar.disconnect(); + this.output = null; + this.scalar = null; + }; + + /** + * Signals can connect to other Signals + * + * @override + * @param {AudioParam|AudioNode|Tone.Signal|Tone} node + */ + Tone.Signal.prototype.connect = function(node){ + //zero it out so that the signal can have full control + if (node instanceof Tone.Signal){ + node.setValue(0); + } else if (node instanceof AudioParam){ + node.value = 0; + } + this.output.connect(node); + }; + + return Tone.Signal; +}); +define('Tone/signal/Add',["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ + + /** + * Adds a value to an incoming signal + * + * @constructor + * @extends {Tone} + * @param {number} value + */ + Tone.Add = function(value){ + Tone.call(this); + + /** + * @private + * @type {Tone} + */ + this._value = new Tone.Signal(value); + + //connections + this.chain(this._value, this.input, this.output); + }; + + Tone.extend(Tone.Add); + + /** + * set the constant + * + * @param {number} value + */ + Tone.Add.prototype.setValue = function(value){ + this._value.setValue(value); + }; + + /** + * dispose method + */ + Tone.Add.prototype.dispose = function(){ + this._value.dispose(); + this.input.disconnect(); + this.output.disconnect(); + this._value = null; + this.input = null; + this.output = null; + }; + + return Tone.Add; +}); +define('Tone/signal/Multiply',["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ + + /** + * Multiply the incoming signal by some factor + * + * @constructor + * @extends {Tone} + * @param {number=} value constant value to multiple + */ + Tone.Multiply = function(value){ + /** + * the input node is the same as the output node + * it is also the GainNode which handles the scaling of incoming signal + * + * @type {GainNode} + */ + this.input = this.context.createGain(); + /** + * @type {GainNode} + */ + this.output = this.input; + + //apply the inital scale factor + this.input.gain.value = this.defaultArg(value, 1); + }; + + Tone.extend(Tone.Multiply); + + /** + * set the constant multiple + * + * @param {number} value + */ + Tone.Multiply.prototype.setValue = function(value){ + this.input.gain.value = value; + }; + + /** + * clean up + */ + Tone.Multiply.prototype.dispose = function(){ + this.input.disconnect(); + this.input = null; + }; + + return Tone.Multiply; +}); + +define('Tone/signal/Scale',["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Multiply"], function(Tone){ + + /** + * performs a linear scaling on an input signal + * + * scales from the input range of inputMin to inputMax + * to the output range of outputMin to outputMax + * + * if only two arguments are provided, the inputMin and inputMax are set to -1 and 1 + * + * @constructor + * @extends {Tone} + * @param {number} inputMin + * @param {number} inputMax + * @param {number=} outputMin + * @param {number=} outputMax + */ + Tone.Scale = function(inputMin, inputMax, outputMin, outputMax){ + Tone.call(this); + + //if there are only two args + if (arguments.length == 2){ + outputMin = inputMin; + outputMax = inputMax; + inputMin = -1; + inputMax = 1; + } + + /** @private + @type {number} */ + this._inputMin = inputMin; + /** @private + @type {number} */ + this._inputMax = inputMax; + /** @private + @type {number} */ + this._outputMin = outputMin; + /** @private + @type {number} */ + this._outputMax = outputMax; + + + /** @private + @type {Tone.Add} */ + this._plusInput = new Tone.Add(0); + /** @private + @type {Tone.Multiply} */ + this._scale = new Tone.Multiply(1); + /** @private + @type {Tone.Add} */ + this._plusOutput = new Tone.Add(0); + + //connections + this.chain(this.input, this._plusInput, this._scale, this._plusOutput, this.output); + + //set the scaling values + this._setScalingParameters(); + }; + + Tone.extend(Tone.Scale); + + /** + * set the scaling parameters + * + * @private + */ + Tone.Scale.prototype._setScalingParameters = function(){ + //components + this._plusInput.setValue(-this._inputMin); + this._scale.setValue((this._outputMax - this._outputMin)/(this._inputMax - this._inputMin)); + this._plusOutput.setValue(this._outputMin); + }; + + /** + * set the input min value + * @param {number} val + */ + Tone.Scale.prototype.setInputMin = function(val){ + this._inputMin = val; + this._setScalingParameters(); + }; + + /** + * set the input max value + * @param {number} val + */ + Tone.Scale.prototype.setInputMax = function(val){ + this._inputMax = val; + this._setScalingParameters(); + }; + + /** + * set the output min value + * @param {number} val + */ + Tone.Scale.prototype.setOutputMin = function(val){ + this._outputMin = val; + this._setScalingParameters(); + }; + + /** + * set the output max value + * @param {number} val + */ + Tone.Scale.prototype.setOutputMax = function(val){ + this._outputMax = val; + this._setScalingParameters(); + }; + + /** + * clean up + */ + Tone.Scale.prototype.dispose = function(){ + this.input.disconnect(); + this.output.disconnect(); + this._plusInput.dispose(); + this._plusOutput.dispose(); + this._scale.dispose(); + this.input = null; + this.output = null; + this._plusInput = null; + this._plusOutput = null; + this._scale = null; + }; + + + return Tone.Scale; +}); + +define('Tone/component/DryWet',["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Scale"], function(Tone){ + + /** + * DRY/WET KNOB + * + * equal power fading control values: + * 0 = 100% dry - 0% wet + * 1 = 0% dry - 100% wet + * + * @constructor + * @param {number=} initialDry + */ + Tone.DryWet = function(initialDry){ + Tone.call(this); + + /** + * connect this input to the dry signal + * the dry signal is also the default input + * + * @type {GainNode} + */ + this.dry = this.input; + + /** + * connect this input to the wet signal + * + * @type {GainNode} + */ + this.wet = this.context.createGain(); + /** + * controls the amount of wet signal + * which is mixed into the dry signal + * + * @type {Tone.Signal} + */ + this.wetness = new Tone.Signal(); + /** + * invert the incoming signal + * @private + * @type {Tone} + */ + this._invert = new Tone.Scale(0, 1, 1, 0); + + //connections + this.dry.connect(this.output); + this.wet.connect(this.output); + //wet control + this.chain(this.wetness, this.wet.gain); + //dry control is the inverse of the wet + this.chain(this.wetness, this._invert, this.dry.gain); + + this.dry.gain.value = 0; + this.wet.gain.value = 0; + + this.setDry(this.defaultArg(initialDry, 0)); + }; + + Tone.extend(Tone.DryWet); + + /** + * Set the dry value + * + * @param {number} val + * @param {Tone.Time=} rampTime + */ + Tone.DryWet.prototype.setDry = function(val, rampTime){ + this.setWet(1-val, rampTime); + }; + + /** + * Set the wet value + * + * @param {number} val + * @param {Tone.Time=} rampTime + */ + Tone.DryWet.prototype.setWet = function(val, rampTime){ + if (rampTime){ + this.wetness.linearRampToValueNow(val, rampTime); + } else { + this.wetness.setValue(val); + } + }; + + /** + * clean up + */ + Tone.DryWet.prototype.dispose = function(){ + this.dry.disconnect(); + this.wet.disconnect(); + this.wetness.dispose(); + this._invert.dispose(); + this.output.disconnect(); + this.dry = null; + this.wet = null; + this.wetness = null; + this._invert = null; + this.output = null; + }; + + return Tone.DryWet; +}); + +define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], function(Tone){ + + /** + * Envelope + * ADR envelope generator attaches to an AudioParam or AudioNode + * + * @constructor + * @extends {Tone} + * @param {Tone.Time=} attack + * @param {Tone.Time=} decay + * @param {number=} sustain a percentage (0-1) of the full amplitude + * @param {Tone.Time=} release + * @param {number=} minOutput the lowest point of the envelope + * @param {number=} maxOutput the highest point of the envelope + */ + Tone.Envelope = function(attack, decay, sustain, release, minOutput, maxOutput){ + //extend Unit + Tone.call(this); + + /** @type {number} */ + this.attack = this.toSeconds(this.defaultArg(attack, 0.01)); + /** @type {number} */ + this.decay = this.toSeconds(this.defaultArg(decay, 0.1)); + /** @type {number} */ + this.release = this.toSeconds(this.defaultArg(release, 1)); + /** @type {number} */ + this.sustain = this.toSeconds(this.defaultArg(sustain, 0.5)); + + /** @type {number} */ + this.min = this.defaultArg(minOutput, 0); + /** @type {number} */ + this.max = this.defaultArg(maxOutput, 1); + + /** @type {Tone.Signal} */ + this.control = new Tone.Signal(this.min); + + //connections + this.chain(this.control, this.output); + }; + + Tone.extend(Tone.Envelope); + + /** + * attack->decay->sustain linear ramp + * @param {Tone.Time=} time + */ + Tone.Envelope.prototype.triggerAttack = function(time){ + var sustainVal = (this.max - this.min) * this.sustain + this.min; + if (!time){ + this.control.linearRampToValueNow(this.max, this.attack); + this.control.linearRampToValueAtTime(sustainVal, this.now() + this.attack + this.decay); + } else { + var startVal = this.min; + time = this.toSeconds(time); + this.control.cancelScheduledValues(time); + this.control.setValueAtTime(startVal, time); + this.control.linearRampToValueAtTime(this.max, time + this.attack); + this.control.linearRampToValueAtTime(sustainVal, time + this.attack + this.decay); + } + }; + + /** + * attack->decay->sustain exponential attack and linear decay + * @param {Tone.Time=} time + */ + Tone.Envelope.prototype.triggerExponentialAttack = function(time){ + var sustainVal = (this.max - this.min) * this.sustain + this.min; + if (!time){ + this.control.exponentialRampToValueNow(this.max, this.attack); + this.control.linearRampToValueAtTime(sustainVal, this.now() + this.attack + this.decay); + } else { + var startVal = this.min; + time = this.toSeconds(time); + this.control.cancelScheduledValues(time); + this.control.setValueAtTime(startVal, time); + this.control.exponentialRampToValueAtTime(this.max, time + this.attack); + this.control.linearRampToValueAtTime(sustainVal, time + this.attack + this.decay); + } + }; + + + /** + * triggers the release of the envelope with a linear ramp + * @param {Tone.Time=} time + */ + Tone.Envelope.prototype.triggerRelease = function(time){ + if (time){ + //if there's a time, start at the sustain value + startVal = (this.max - this.min) * this.sustain + this.min; + time = this.toSeconds(time); + this.control.cancelScheduledValues(time); + this.control.setValueAtTime(startVal, time); + this.control.linearRampToValueAtTime(this.min, time + this.toSeconds(this.release)); + } else { + this.control.linearRampToValueNow(this.min, this.toSeconds(this.release)); + } + }; + + + /** + * triggers the release of the envelope with an exponential ramp + * + * @param {Tone.Time=} time + */ + Tone.Envelope.prototype.triggerExponentialRelease = function(time){ + if (time){ + //if there's a time, start at the sustain value + startVal = (this.max - this.min) * this.sustain + this.min; + time = this.toSeconds(time); + this.control.cancelScheduledValues(time); + this.control.setValueAtTime(startVal, time); + this.control.exponentialRampToValueAtTime(this.min, time + this.toSeconds(this.release)); + } else { + this.control.exponentialRampToValueNow(this.min, this.toSeconds(this.release)); + } + }; + + /** + * pointer to the parent's connect method + * @private + */ + Tone.Envelope.prototype._connect = Tone.prototype.connect; + + /** + * connect the envelope + * + * if the envelope is connected to a param, the params + * value will be set to 0 so that it doesn't interfere with the envelope + * + * @param {number} param + */ + Tone.Envelope.prototype.connect = function(param){ + if (param instanceof AudioParam){ + //set the initial value + param.value = 0; + } + this._connect(param); + }; + + /** + * disconnect and dispose + */ + Tone.Envelope.prototype.dispose = function(){ + this.control.dispose(); + this.control = null; + }; + + return Tone.Envelope; +}); + +define('Tone/core/Transport',["Tone/core/Tone", "Tone/core/Master", "Tone/signal/Signal"], +function(Tone){ + + /** + * oscillator-based transport allows for simple musical timing + * supports tempo curves and time changes + * + * @constructor + * @extends {Tone} + */ + Tone.Transport = function(){ + + /** + * watches the main oscillator for timing ticks + * + * @private + * @type {ScriptProcessorNode} + */ + this._jsNode = this.context.createScriptProcessor(this.bufferSize, 1, 1); + this._jsNode.onaudioprocess = this._processBuffer.bind(this); + + /** + * @type {boolean} + */ + this.loop = false; + + /** + * @type {TransportState} + */ + this.state = TransportState.STOPPED; + + //so it doesn't get garbage collected + this._jsNode.noGC(); + }; + + Tone.extend(Tone.Transport); + + /** + * @private + * @type {number} + */ + var timelineTicks = 0; + /** + * @private + * @type {number} + */ + var transportTicks = 0; + /** + * @private + * @type {number} + */ + var tatum = 12; + /** + * @private + * @type {Boolean} + */ + var upTick = false; + /** + * @private + * @type {number} + */ + var transportTimeSignature = 4; + + /** + * @private + * @type {number} + */ + var loopStart = 0; + /** + * @private + * @type {number} + */ + var loopEnd = tatum * 4; + + /** + * @private + * @type {Array} + */ + var intervals = []; + + /** + * @private + * @type {Array} + */ + var timeouts = []; + + /** + * @private + * @type {Array} + */ + var transportTimeline = []; + + /** + * @private + * @type {number} + */ + var timelineProgress = 0; + + /** + * The main oscillator for the system + * @private + * @type {OscillatorNode} + */ + var oscillator = null; + + /** + * controls the oscillator frequency + * starts at 120bpm + * + * @private + * @type {Tone.Signal} + */ + var controlSignal = new Tone.Signal(24); + + /** + * All of the synced components + * @private + * @type {Array<Tone>} + */ + var SyncedComponents = []; + + + /** + * @enum + */ + var TransportState = { + STARTED : "started", + PAUSED : "paused", + STOPPED : "stopped" + }; + + + /////////////////////////////////////////////////////////////////////////////// + // JS NODE PROCESSING + /////////////////////////////////////////////////////////////////////////////// + + /** + * called when a buffer is ready + * + * @param {AudioProcessingEvent} event + */ + Tone.Transport.prototype._processBuffer = function(event){ + var now = this.defaultArg(event.playbackTime, this.now()); + var bufferSize = this._jsNode.bufferSize; + var incomingBuffer = event.inputBuffer.getChannelData(0); + for (var i = 0; i < bufferSize; i++){ + var sample = incomingBuffer[i]; + if (sample > 0 && !upTick){ + upTick = true; + this._processTick(now + this.samplesToSeconds(i)); + } else if (sample < 0 && upTick){ + upTick = false; + } + } + }; + + //@param {number} tickTime + Tone.Transport.prototype._processTick = function(tickTime){ + if (oscillator !== null){ + processIntervals(tickTime); + processTimeouts(tickTime); + processTimeline(tickTime); + transportTicks += 1; + timelineTicks += 1; + if (this.loop){ + if (timelineTicks === loopEnd){ + this._setTicks(loopStart); + } + } + } + }; + + //jump to a specific tick in the timeline + Tone.Transport.prototype._setTicks = function(ticks){ + timelineTicks = ticks; + for (var i = 0; i < transportTimeline.length; i++){ + var timeout = transportTimeline[i]; + if (timeout.callbackTick() >= ticks){ + timelineProgress = i; + break; + } + } + }; + + /////////////////////////////////////////////////////////////////////////////// + // EVENT PROCESSING + /////////////////////////////////////////////////////////////////////////////// + + /** + * process the intervals + * @param {number} time + */ + var processIntervals = function(time){ + for (var i = 0, len = intervals.length; i<len; i++){ + var interval = intervals[i]; + if (interval.testInterval(transportTicks)){ + interval.doCallback(time); + } + } + }; + + /** + * process the timeouts + * @param {number} time + */ + var processTimeouts = function(time){ + var removeTimeouts = 0; + for (var i = 0, len = timeouts.length; i<len; i++){ + var timeout = timeouts[i]; + var callbackTick = timeout.callbackTick(); + if (callbackTick <= transportTicks){ + timeout.doCallback(time); + removeTimeouts++; + } else if (callbackTick > transportTicks){ + break; + } + } + //remove the timeouts off the front of the array after they've been called + timeouts.splice(0, removeTimeouts); + }; + + /** + * process the transportTimeline events + * @param {number} time + */ + var processTimeline = function(time){ + for (var i = timelineProgress, len = transportTimeline.length; i<len; i++){ + var evnt = transportTimeline[i]; + var callbackTick = evnt.callbackTick(); + if (callbackTick === timelineTicks){ + evnt.doCallback(time); + timelineProgress = i; + } else if (callbackTick > timelineTicks){ + break; + } + } + }; + + /** + * clear the timeouts and intervals + */ + function clearTimelineEvents(){ + + intervals = []; + } + + /////////////////////////////////////////////////////////////////////////////// + // INTERVAL + /////////////////////////////////////////////////////////////////////////////// + + /** + * intervals are recurring events + * + * @param {function} callback + * @param {Tone.Time} interval + * @param {Object} ctx the context the function is invoked in + * @return {number} the id of the interval + */ + Tone.Transport.prototype.setInterval = function(callback, interval, ctx){ + var tickTime = this.toTicks(interval); + var timeout = new TimelineEvent(callback, ctx, tickTime, transportTicks); + intervals.push(timeout); + return timeout.id; + }; + + /** + * clear an interval from the processing array + * @param {number} rmInterval the interval to remove + * @return {boolean} true if the event was removed + */ + Tone.Transport.prototype.clearInterval = function(rmInterval){ + for (var i = 0; i < intervals.length; i++){ + var interval = intervals[i]; + if (interval.id === rmInterval){ + intervals.splice(i, 1); + return true; + } + } + return false; + }; + + /** + * removes all of the intervals that are currently set + */ + Tone.Transport.prototype.clearIntervals = function(){ + intervals = []; + }; + + /////////////////////////////////////////////////////////////////////////////// + // TIMEOUT + /////////////////////////////////////////////////////////////////////////////// + + /** + * set a timeout to occur after time from now + * + * @param {function} callback + * @param {Tone.Time} time + * @param {Object} ctx the context to invoke the callback in + * @return {number} the id of the timeout for clearing timeouts + */ + Tone.Transport.prototype.setTimeout = function(callback, time, ctx){ + var ticks = this.toTicks(time); + var timeout = new TimelineEvent(callback, ctx, ticks + transportTicks, 0); + //put it in the right spot + for (var i = 0, len = timeouts.length; i<len; i++){ + var testEvnt = timeouts[i]; + if (testEvnt.callbackTick() > timeout.callbackTick()){ + timeouts.splice(i, 0, timeout); + return timeout.id; + } + } + //otherwise push it on the end + timeouts.push(timeout); + return timeout.id; + }; + + /** + * clear the timeout based on it's ID + * @param {number} timeoutID + * @return {boolean} true if the timeout was removed + */ + Tone.Transport.prototype.clearTimeout = function(timeoutID){ + for (var i = 0; i < timeouts.length; i++){ + var testTimeout = timeouts[i]; + if (testTimeout.id === timeoutID){ + timeouts.splice(i, 1); + return true; + } + } + return false; + }; + + /** + * removes all of the timeouts that are currently set + * + * @todo (optionally) remove events after a certain time + */ + Tone.Transport.prototype.clearTimeouts = function(){ + timeouts = []; + }; + + /////////////////////////////////////////////////////////////////////////////// + // TIMELINE + /////////////////////////////////////////////////////////////////////////////// + + /** + * Timeline events are synced to the transportTimeline of the Transport + * Unlike Timeout, Timeline events will restart after the + * Transport has been stopped and restarted. + * + * + * @param {function} callback + * @param {Tome.Time} timeout + * @param {Object} ctx the context in which the funtion is called + * @return {number} the id for clearing the transportTimeline event + */ + Tone.Transport.prototype.setTimeline = function(callback, timeout, ctx){ + var ticks = this.toTicks(timeout); + var timelineEvnt = new TimelineEvent(callback, ctx, ticks, 0); + //put it in the right spot + for (var i = timelineProgress, len = transportTimeline.length; i<len; i++){ + var testEvnt = transportTimeline[i]; + if (testEvnt.callbackTick() > timelineEvnt.callbackTick()){ + transportTimeline.splice(i, 0, timelineEvnt); + return timelineEvnt.id; + } + } + //otherwise push it on the end + transportTimeline.push(timelineEvnt); + return timelineEvnt.id; + }; + + /** + * clear the transportTimeline event from the + * @param {number} timelineID + * @return {boolean} true if it was removed + */ + Tone.Transport.prototype.clearTimeline = function(timelineID){ + for (var i = 0; i < transportTimeline.length; i++){ + var testTimeline = transportTimeline[i]; + if (testTimeline.id === timelineID){ + transportTimeline.splice(i, 1); + return true; + } + } + return false; + }; + + /** + * remove all events from the timeline + */ + Tone.Transport.prototype.clearTimelines = function(){ + timelineProgress = 0; + transportTimeline = []; + }; + + /////////////////////////////////////////////////////////////////////////////// + // TIME CONVERSIONS + /////////////////////////////////////////////////////////////////////////////// + + /** + * turns the time into + * @param {Tone.Time} time + * @return {number} + */ + Tone.Transport.prototype.toTicks = function(time){ + //get the seconds + var seconds = this.toSeconds(time); + var quarter = this.notationToSeconds("4n"); + var quarters = seconds / quarter; + var tickNum = quarters * tatum; + //quantize to tick value + return Math.round(tickNum); + }; + + /** + * get the transport time + * @return {string} in transportTime format (measures:beats:sixteenths) + */ + Tone.Transport.prototype.getTransportTime = function(){ + var quarters = timelineTicks / tatum; + var measures = Math.floor(quarters / transportTimeSignature); + var sixteenths = Math.floor((quarters % 1) * 4); + quarters = Math.floor(quarters) % transportTimeSignature; + var progress = [measures, quarters, sixteenths]; + return progress.join(":"); + }; + + /** + * set the transport time, jump to the position right away + * + * @param {Tone.Time} progress + */ + Tone.Transport.prototype.setTransportTime = function(progress){ + var ticks = this.toTicks(progress); + this._setTicks(ticks); + }; + + /////////////////////////////////////////////////////////////////////////////// + // START/STOP/PAUSE + /////////////////////////////////////////////////////////////////////////////// + + /** + * start the transport and all sources synced to the transport + * + * @param {Tone.Time} time + */ + Tone.Transport.prototype.start = function(time){ + if (this.state === TransportState.STOPPED || this.state === TransportState.PAUSED){ + this.state = TransportState.STARTED; + //reset the oscillator + oscillator = this.context.createOscillator(); + oscillator.type = "square"; + oscillator.connect(this._jsNode); + //connect it up + controlSignal.connect(oscillator.frequency); + oscillator.frequency.value = 0; + upTick = false; + oscillator.start(this.toSeconds(time)); + + //call start on each of the synced sources + } + }; + + + /** + * stop the transport and all sources synced to the transport + * + * @param {Tone.Time} time + */ + Tone.Transport.prototype.stop = function(time){ + if (this.state === TransportState.STARTED || this.state === TransportState.PAUSED){ + this.state = TransportState.STOPPED; + oscillator.stop(this.toSeconds(time)); + oscillator = null; + this._setTicks(0); + this.clearTimeouts(); + this.clearIntervals(); + + //call stop on each of the synced sources + } + }; + + /** + * pause the transport and all sources synced to the transport + * + * @param {Tone.Time} time + */ + Tone.Transport.prototype.pause = function(time){ + if (this.state === TransportState.STARTED){ + this.state = TransportState.PAUSED; + oscillator.stop(this.toSeconds(time)); + oscillator = null; + clearTimelineEvents(); + //call pause on each of the synced sources + } + }; + + /////////////////////////////////////////////////////////////////////////////// + // SETTERS/GETTERS + /////////////////////////////////////////////////////////////////////////////// + + /** + * set the BPM + * optionally ramp to the bpm over some time + * @param {number} bpm + * @param {Tone.Time=} rampTime + */ + Tone.Transport.prototype.setBpm = function(bpm, rampTime){ + //convert the bpm to frequency + var tatumFreq = this.secondsToFrequency(this.notationToSeconds(tatum.toString() + "n", bpm, transportTimeSignature)); + // var tatumFreq = this.toFrequency(tatum.toString() + "n", bpm, transportTimeSignature); + var freqVal = 4 * tatumFreq; + if (!rampTime){ + controlSignal.cancelScheduledValues(0); + controlSignal.setValue(freqVal); + } else { + controlSignal.exponentialRampToValueNow(freqVal, rampTime); + } + }; + + /** + * return the current BPM + * + * @return {number} + */ + Tone.Transport.prototype.getBpm = function(){ + //convert the current frequency of the oscillator to bpm + var freq = controlSignal.getValue(); + return 60 * (freq / tatum); + }; + + /** + * set the time signature + * + * @example + * this.setTimeSignature(4); //for 4/4 + * + * @param {number} numerator + * @param {number=} denominator defaults to 4 + */ + Tone.Transport.prototype.setTimeSignature = function(numerator, denominator){ + denominator = this.defaultArg(denominator, 4); + transportTimeSignature = numerator / (denominator / 4); + }; + + /** + * return the time signature as just the numerator + * over 4 is assumed. + * for example 4/4 would return 4 and 6/8 would return 3 + * + * @return {number} + */ + Tone.Transport.prototype.getTimeSignature = function(){ + return transportTimeSignature; + }; + + /** + * set the loop start position + * + * @param {Tone.Time} startPosition + */ + Tone.Transport.prototype.setLoopStart = function(startPosition){ + loopStart = this.toTicks(startPosition); + }; + + /** + * set the loop start position + * + * @param {Tone.Time} endPosition + */ + Tone.Transport.prototype.setLoopEnd = function(endPosition){ + loopEnd = this.toTicks(endPosition); + }; + + /** + * shorthand loop setting + * @param {Tone.Time} startPosition + * @param {Tone.Time} endPosition + */ + Tone.Transport.prototype.setLoopPoint = function(startPosition, endPosition){ + this.setLoopStart(startPosition); + this.setLoopEnd(endPosition); + }; + + /////////////////////////////////////////////////////////////////////////////// + // SYNCING + /////////////////////////////////////////////////////////////////////////////// + + + Tone.Transport.prototype.sync = function(source, controlSignal){ + //create a gain node, attach it to the control signal + // var ratio = new Tone.Multiply(); + // controlSignal.connect(ratio); + // return ratio; + }; + + /** + * remove the source from the list of Synced Sources + * + * @param {Tone.Source} source [description] + */ + Tone.Transport.prototype.unsync = function(source){ + + }; + + + /////////////////////////////////////////////////////////////////////////////// + // TIMELINE EVENT + /////////////////////////////////////////////////////////////////////////////// + + /** + * @static + * @type {number} + */ + var TimelineEventIDCounter = 0; + + /** + * A Timeline event + * + * @constructor + * @param {function(number)} callback + * @param {Object} context + * @param {number} tickTime + * @param {number} startTicks + */ + var TimelineEvent = function(callback, context, tickTime, startTicks){ + this.startTicks = startTicks; + this.tickTime = tickTime; + this.callback = callback; + this.context = context; + this.id = TimelineEventIDCounter++; + }; + + /** + * invoke the callback in the correct context + * passes in the playback time + * + * @param {number} playbackTime + */ + TimelineEvent.prototype.doCallback = function(playbackTime){ + this.callback.call(this.context, playbackTime); + }; + + /** + * get the tick which the callback is supposed to occur on + * + * @return {number} + */ + TimelineEvent.prototype.callbackTick = function(){ + return this.startTicks + this.tickTime; + }; + + /** + * test if the tick occurs on the interval + * + * @param {number} tick + * @return {boolean} + */ + TimelineEvent.prototype.testInterval = function(tick){ + return (tick - this.startTicks) % this.tickTime === 0; + }; + + + /////////////////////////////////////////////////////////////////////////////// + // AUGMENT TONE'S PROTOTYPE TO INCLUDE TRANSPORT TIMING + /////////////////////////////////////////////////////////////////////////////// + + /** + * tests if a string is musical notation + * i.e.: + * 4n = quarter note + * 2m = two measures + * 8t = eighth-note triplet + * + * @return {boolean} + * @method isNotation + * @lends Tone.prototype.isNotation + */ + Tone.prototype.isNotation = (function(){ + var notationFormat = new RegExp(/[0-9]+[mnt]$/i); + return function(note){ + return notationFormat.test(note); + }; + })(); + + /** + * tests if a string is transportTime + * i.e. : + * 1:2:0 = 1 measure + two quarter notes + 0 sixteenth notes + * + * @return {boolean} + * + * @lends Tone.prototype.isTransportTime + */ + Tone.prototype.isTransportTime = (function(){ + var transportTimeFormat = new RegExp(/^\d+(\.\d+)?:\d+(\.\d+)?(:\d+(\.\d+)?)?$/); + return function(transportTime){ + return transportTimeFormat.test(transportTime); + }; + })(); + + /** + * true if the input is in the format number+hz + * i.e.: 10hz + * + * @param {number} freq + * @return {boolean} + * + * @lends Tone.prototype.isFrequency + */ + Tone.prototype.isFrequency = (function(){ + var freqFormat = new RegExp(/[0-9]+hz$/i); + return function(freq){ + return freqFormat.test(freq); + }; + })(); + + + /** + * + * convert notation format strings to seconds + * @param {string} notation + * @param {number=} bpm + * @param {number=} timeSignature + * @return {number} + * + */ + Tone.prototype.notationToSeconds = function(notation, bpm, timeSignature){ + bpm = this.defaultArg(bpm, Tone.Transport.getBpm()); + timeSignature = this.defaultArg(timeSignature, transportTimeSignature); + var beatTime = (60 / bpm); + var subdivision = parseInt(notation, 10); + var beats = 0; + if (subdivision === 0){ + beats = 0; + } + var lastLetter = notation.slice(-1); + if (lastLetter === "t"){ + beats = (4 / subdivision) * 2/3; + } else if (lastLetter === "n"){ + beats = 4 / subdivision; + } else if (lastLetter === "m"){ + beats = subdivision * timeSignature; + } else { + beats = 0; + } + return beatTime * beats; + }; + + /** + * convert transportTime into seconds + * + * ie: 4:2:3 == 4 measures + 2 quarters + 3 sixteenths + * + * @param {string} transportTime + * @param {number=} bpm + * @param {number=} timeSignature + * @return {number} seconds + * + * @lends Tone.prototype.transportTimeToSeconds + */ + Tone.prototype.transportTimeToSeconds = function(transportTime, bpm, timeSignature){ + bpm = this.defaultArg(bpm, Tone.Transport.getBpm()); + timeSignature = this.defaultArg(timeSignature, transportTimeSignature); + var measures = 0; + var quarters = 0; + var sixteenths = 0; + var split = transportTime.split(":"); + if (split.length === 2){ + measures = parseFloat(split[0]); + quarters = parseFloat(split[1]); + } else if (split.length === 1){ + quarters = parseFloat(split[0]); + } else if (split.length === 3){ + measures = parseFloat(split[0]); + quarters = parseFloat(split[1]); + sixteenths = parseFloat(split[2]); + } + var beats = (measures * timeSignature + quarters + sixteenths / 4); + return beats * this.notationToSeconds("4n"); + }; + + /** + * Convert seconds to the closest transportTime in the form + * measures:quarters:sixteenths + * + * @method toTransportTime + * + * @param {Tone.Time} seconds + * @param {number=} bpm + * @param {number=} timeSignature + * @return {string} + * + * @lends Tone.prototype.toTransportTime + */ + Tone.prototype.toTransportTime = function(time, bpm, timeSignature){ + var seconds = this.toSeconds(time, bpm, timeSignature); + bpm = this.defaultArg(bpm, Tone.Transport.getBpm()); + timeSignature = this.defaultArg(timeSignature, transportTimeSignature); + var quarterTime = this.notationToSeconds("4n"); + var quarters = seconds / quarterTime; + var measures = Math.floor(quarters / timeSignature); + var sixteenths = Math.floor((quarters % 1) * 4); + quarters = Math.floor(quarters) % timeSignature; + var progress = [measures, quarters, sixteenths]; + return progress.join(":"); + }; + + /** + * convert a time to a frequency + * + * @param {Tone.Time} time + * @return {number} the time in hertz + */ + Tone.prototype.toFrequency = function(time, now){ + if (this.isFrequency(time)){ + return parseFloat(time); + } else if (this.isNotation(time) || this.isTransportTime(time)) { + return this.secondsToFrequency(this.toSeconds(time, now)); + } else { + return time; + } + }; + + /** + * convert Tone.Time into seconds. + * + * unlike the method which it overrides, this takes into account + * transporttime and musical notation + * + * @override + * @param {Tone.Time} time + * @param {number=} now if passed in, this number will be + * used for all 'now' relative timings + * @return {number} + */ + Tone.prototype.toSeconds = function(time, now){ + now = this.defaultArg(now, this.now()); + if (typeof time === "number"){ + return time; //assuming that it's seconds + } else if (typeof time === "string"){ + var plusTime = 0; + if(time.charAt(0) === "+") { + plusTime = now; + time = time.slice(1); + } + if (this.isNotation(time)){ + time = this.notationToSeconds(time); + } else if (this.isTransportTime(time)){ + time = this.transportTimeToSeconds(time); + } else if (this.isFrequency(time)){ + time = this.frequencyToSeconds(time); + } else { + time = parseFloat(time); + } + return time + plusTime; + } else { + return now; + } + }; + + //a single transport object + Tone.Transport = new Tone.Transport(); + + return Tone.Transport; +}); + +define('Tone/source/Source',["Tone/core/Tone", "Tone/core/Transport"], function(Tone){ + /** + * base class for sources + * + * sources have start/stop/pause + * + * they also have the ability to be synced to the + * start/stop/pause of Tone.Transport + * + * @constructor + * @extends {Tone} + */ + Tone.Source = function(){ + /** + * unlike most ToneNodes, Sources only have an output and no input + * + * @type {GainNode} + */ + this.output = this.context.createGain(); + + /** + * @type {Tone.Source.State} + */ + this.state = Tone.Source.State.STOPPED; + }; + + Tone.extend(Tone.Source); + + /** + * @abstract + * @param {Tone.Time} time + */ + Tone.Source.prototype.start = function(){}; + + /** + * @abstract + * @param {Tone.Time} time + */ + Tone.Source.prototype.stop = function(){}; + + + /** + * @abstract + * @param {Tone.Time} time + */ + Tone.Source.prototype.pause = function(time){ + //if there is no pause, just stop it + this.stop(time); + }; + + /** + * sync the source to the Transport + */ + Tone.Source.prototype.sync = function(){ + if (this.state !== Tone.Source.State.SYNCED){ + this.state = Tone.Source.State.SYNCED; + Tone.Transport.sync(this); + } + }; + + /** + * unsync the source to the Transport + */ + Tone.Source.prototype.unsync = function(){ + if (this.state === Tone.Source.State.SYNCED){ + Tone.Transport.unsync(this); + } + }; + + + /** + * @param {number} value + * @param {Tone.Time=} fadeTime (optional) time it takes to reach the value + */ + Tone.Source.prototype.setVolume = function(value, fadeTime){ + var now = this.now(); + if (fadeTime){ + var currentVolume = this.output.gain.value; + this.output.gain.cancelScheduledValues(now); + this.output.gain.setValueAtTime(currentVolume, now); + this.output.gain.linearRampToValueAtTime(value, now + this.toSeconds(time)); + } else { + this.output.gain.setValueAtTime(value, now); + } + }; + + /** + * @enum {string} + */ + Tone.Source.State = { + STARTED : "started", + PAUSED : "paused", + STOPPED : "stopped", + SYNCED : "synced" + }; + + return Tone.Source; +}); +define('Tone/source/Oscillator',["Tone/core/Tone", "Tone/core/Transport", "Tone/signal/Signal", "Tone/source/Source"], +function(Tone){ + + /** + * Oscillator + * + * Oscilator with start, pause, stop and sync to Transport + * + * @constructor + * @extends {Tone.Source} + * @param {number|string=} freq starting frequency + * @param {string=} type type of oscillator (sine|square|triangle|sawtooth) + */ + Tone.Oscillator = function(freq, type){ + Tone.Source.call(this); + + /** + * the main oscillator + * @type {OscillatorNode} + */ + this.oscillator = this.context.createOscillator(); + /** + * the frequency control signal + * @type {Tone.Signal} + */ + this.frequency = new Tone.Signal(this.defaultArg(this.toFrequency(freq), 440)); + + /** + * @type {function()} + */ + this.onended = function(){}; + + //connections + this.oscillator.connect(this.output); + //setup + this.oscillator.type = this.defaultArg(type, "sine"); + }; + + Tone.extend(Tone.Oscillator, Tone.Source); + + /** + * start the oscillator + * + * @param {Tone.Time} time + */ + Tone.Oscillator.prototype.start = function(time){ + if (this.state === Tone.Source.State.STOPPED){ + this.state = Tone.Source.State.STARTED; + //get previous values + var type = this.oscillator.type; + var detune = this.oscillator.detune.value; + //new oscillator with previous values + this.oscillator = this.context.createOscillator(); + this.oscillator.type = type; + this.oscillator.detune.value = detune; + //connect the control signal to the oscillator frequency + this.oscillator.connect(this.output); + this.frequency.connect(this.oscillator.frequency); + this.oscillator.frequency.value = 0; + //start the oscillator + this.oscillator.start(this.toSeconds(time)); + this.oscillator.onended = this._onended.bind(this); + } + }; + + /** + * stop the oscillator + * @param {Tone.Time=} time (optional) timing parameter + */ + Tone.Oscillator.prototype.stop = function(time){ + if (this.state === Tone.Source.State.STARTED){ + if (!time){ + this.state = Tone.Source.State.STOPPED; + } + this.oscillator.stop(this.toSeconds(time)); + } + }; + + /** + * Sync the oscillator to the transport + * + * the current ratio between the oscillator and the Transport BPM + * is fixed and any change to the Transport BPM will change this + * oscillator in that same ratio + * + * Transport start/pause/stop will also start/pause/stop the oscillator + */ + Tone.Oscillator.prototype.sync = function(){ + if (this.state !== Tone.Source.State.SYNCED){ + this.state = Tone.Source.State.SYNCED; + Tone.Transport.sync(this); + Tone.Transport.syncSignal(this.frequency); + } + }; + + /** + * unsync the oscillator from the Transport + */ + Tone.Oscillator.prototype.unsync = function(){ + if (this.state === Tone.Source.State.SYNCED){ + Tone.Transport.unsync(this); + this.frequency.unsync(); + } + }; + + /** + * exponentially ramp the frequency of the oscillator over the rampTime + * + * @param {Tone.Time} val + * @param {Tone.Time=} rampTime when the oscillator will arrive at the frequency + */ + Tone.Oscillator.prototype.setFrequency = function(val, rampTime){ + if (rampTime){ + this.frequency.exponentialRampToValueAtTime(this.toFrequency(val), this.toSeconds(rampTime)); + } else { + this.frequency.setValue(this.toFrequency(val)); + } + }; + + /** + * set the oscillator type + * + * @param {string} type (sine|square|triangle|sawtooth) + */ + Tone.Oscillator.prototype.setType = function(type){ + this.oscillator.type = type; + }; + + /** + * internal on end call + * @private + */ + Tone.Oscillator.prototype._onended = function(){ + this.state = Tone.Source.State.STOPPED; + this.onended(); + }; + + /** + * dispose and disconnect + */ + Tone.Oscillator.prototype.dispose = function(){ + if (this.oscillator !== null){ + this.oscillator.disconnect(); + this.oscillator = null; + } + this.frequency.dispose(); + this.frequency = null; + this.output.disconnect(); + this.output = null; + }; + + return Tone.Oscillator; +}); +define('Tone/component/LFO',["Tone/core/Tone", "Tone/source/Oscillator", "Tone/signal/Scale"], function(Tone){ + + /** + * Low Frequency Oscillator + * + * LFO produces an output signal which can be attached to an AudioParam + * for constant control over that parameter + * the LFO can also be synced to the transport + * + * @constructor + * @extends {Tone} + * @param {number} rate + * @param {number=} outputMin + * @param {number=} outputMax + */ + Tone.LFO = function(rate, outputMin, outputMax){ + /** @type {GainNode} */ + this.input = this.context.createGain(); + /** @type {Tone.Oscillator} */ + this.oscillator = new Tone.Oscillator(this.defaultArg(rate, 1), "sine"); + /** + @type {Tone.Scale} + @private + */ + this._scaler = new Tone.Scale(this.defaultArg(outputMin, 0), this.defaultArg(outputMax, 1)); + /** alias for the output */ + this.output = this._scaler; + + //connect it up + this.chain(this.oscillator, this.output); + }; + + Tone.extend(Tone.LFO); + + /** + * start the LFO + * @param {Tone.Time} time + */ + Tone.LFO.prototype.start = function(time){ + this.oscillator.start(time); + }; + + /** + * stop the LFO + * @param {Tone.Time} time + */ + Tone.LFO.prototype.stop = function(time){ + this.oscillator.stop(time); + }; + + /** + * Sync the start/stop/pause to the transport + * and the frequency to the bpm of the transport + */ + Tone.LFO.prototype.sync = function(){ + this.oscillator.sync(); + }; + + /** + * unsync the LFO from transport control + */ + Tone.LFO.prototype.unsync = function(){ + this.oscillator.unsync(); + }; + + + /** + * set the frequency + * @param {number} rate + */ + Tone.LFO.prototype.setFrequency = function(rate){ + this.oscillator.setFrequency(rate); + }; + + /** + * set the minimum output of the LFO + * @param {number} min + */ + Tone.LFO.prototype.setMin = function(min){ + this._scaler.setOutputMin(min); + }; + + /** + * set the maximum output of the LFO + * @param {number} min + */ + Tone.LFO.prototype.setMax = function(max){ + this._scaler.setOuputMax(max); + }; + + /** + * set the waveform of the LFO + * @param {string} type + */ + Tone.LFO.prototype.setType = function(type){ + this.oscillator.setType(type); + }; + + /** + * pointer to the parent's connect method + * @private + */ + Tone.LFO.prototype._connect = Tone.prototype.connect; + + /** + * override the connect method so that it 0's out the value + * if attached to an AudioParam + * + * @borrows Tone.Signal.connect as Tone.LFO.connect + */ + Tone.LFO.prototype.connect = Tone.Signal.prototype.connect; + + /** + * disconnect and dispose + */ + Tone.LFO.prototype.dispose = function(){ + this.oscillator.dispose(); + this.output.disconnect(); + this._scaler.dispose(); + this.oscillator = null; + this.output = null; + this._scaler = null; + }; + + return Tone.LFO; +}); +define('Tone/component/Meter',["Tone/core/Tone", "Tone/core/Master"], function(Tone){ + + /** + * get the rms of the input signal with some averaging + * can also just get the value of the signal + * or the value in dB + * + * inspired by https://github.com/cwilso/volume-meter/blob/master/volume-meter.js + * The MIT License (MIT) Copyright (c) 2014 Chris Wilson + * + * @constructor + * @extends {Tone} + * @param {number=} channels (optional) number of channels being metered + * @param {number=} smoothing (optional) amount of smoothing applied to the volume + * @param {number=} clipMemory (optional) number in ms that a "clip" should be remembered + */ + Tone.Meter = function(channels, smoothing, clipMemory){ + //extends Unit + Tone.call(this); + + /** @type {number} */ + this.channels = this.defaultArg(channels, 1); + + /** @type {number} */ + this.smoothing = this.defaultArg(smoothing, 0.8); + + /** @type {number} */ + this.clipMemory = this.defaultArg(clipMemory, 500); + + /** + * the rms for each of the channels + * @private + * @type {Array<number>} + */ + this._volume = new Array(this.channels); + + /** + * the raw values for each of the channels + * @private + * @type {Array<number>} + */ + this._values = new Array(this.channels); + + //zero out the volume array + for (var i = 0; i < this.channels; i++){ + this._volume[i] = 0; + this._values[i] = 0; + } + + /** + * last time the values clipped + * @private + * @type {number} + */ + this._lastClip = 0; + + /** + * @private + * @type {ScriptProcessorNode} + */ + this._jsNode = this.context.createScriptProcessor(this.bufferSize, this.channels, 1); + this._jsNode.onaudioprocess = this._onprocess.bind(this); + //so it doesn't get garbage collected + this._jsNode.noGC(); + + //signal just passes + this.input.connect(this.output); + this.input.connect(this._jsNode); + }; + + Tone.extend(Tone.Meter); + + /** + * called on each processing frame + * @private + * @param {AudioProcessingEvent} event + */ + Tone.Meter.prototype._onprocess = function(event){ + var bufferSize = this._jsNode.bufferSize; + var smoothing = this.smoothing; + for (var channel = 0; channel < this.channels; channel++){ + var input = event.inputBuffer.getChannelData(channel); + var sum = 0; + var total = 0; + var x; + var clipped = false; + for (var i = 0; i < bufferSize; i++){ + x = input[i]; + if (!clipped && x > 0.95){ + clipped = true; + this._lastClip = Date.now(); + } + total += x; + sum += x * x; + } + var average = total / bufferSize; + var rms = Math.sqrt(sum / bufferSize); + this._volume[channel] = Math.max(rms, this._volume[channel] * smoothing); + this._values[channel] = average; + } + }; + + /** + * get the rms of the signal + * + * @param {number=} channel which channel + * @return {number} the value + */ + Tone.Meter.prototype.getLevel = function(channel){ + channel = this.defaultArg(channel, 0); + var vol = this._volume[channel]; + if (vol < 0.00001){ + return 0; + } else { + return vol; + } + }; + + /** + * get the value of the signal + * @param {number=} channel + * @return {number} + */ + Tone.Meter.prototype.getValue = function(channel){ + channel = this.defaultArg(channel, 0); + return this._values[channel]; + }; + + /** + * get the volume of the signal in dB + * @param {number=} channel + * @return {number} + */ + Tone.Meter.prototype.getDb = function(channel){ + return this.gainToDb(this.getLevel(channel)); + }; + + // @returns {boolean} if the audio has clipped in the last 500ms + Tone.Meter.prototype.isClipped = function(){ + return Date.now() - this._lastClip < this.clipMemory; + }; + + /** + * @override + */ + Tone.Meter.prototype.dispose = function(){ + this._jsNode.disconnect(); + this._jsNode.onaudioprocess = null; + this._volume = null; + this._values = null; + this.input.disconnect(); + this.output.disconnect(); + }; + + return Tone.Meter; +}); +define('Tone/signal/Merge',["Tone/core/Tone"], function(Tone){ + + /** + * merge a left and a right channel into a single stereo channel + * + * instead of connecting to the input, connect to either the left, or right input + * + * default input for connect is left input + * + * @constructor + * @extends {Tone} + */ + Tone.Merge = function(){ + + Tone.call(this); + + /** + * the left input channel + * also an alias for the input + * @type {GainNode} + */ + this.left = this.input; + /** + * the right input channel + * @type {GainNode} + */ + this.right = this.context.createGain(); + /** + * the merger node for the two channels + * @type {ChannelMergerNode} + */ + this.merger = this.context.createChannelMerger(2); + + //connections + this.left.connect(this.merger, 0, 0); + this.right.connect(this.merger, 0, 1); + this.merger.connect(this.output); + }; + + Tone.extend(Tone.Merge); + + /** + * clean up + */ + Tone.Merge.prototype.dispose = function(){ + this.input.disconnect(); + this.right.disconnect(); + this.merger.disconnect(); + this.input = null; + this.right = null; + this.merger = null; + }; + + return Tone.Merge; +}); + +define('Tone/signal/Split',["Tone/core/Tone"], function(Tone){ + + /** + * split the incoming signal into left and right channels + * + * the left channel is the default output + * + * @constructor + * @extends {Tone} + */ + Tone.Split = function(){ + Tone.call(this); + + /** + * @type {ChannelSplitterNode} + */ + this.splitter = this.context.createChannelSplitter(2); + /** + * left channel output + * @type {GainNode} + */ + this.left = this.output; + /** + * the right channel output + * @type {GainNode} + */ + this.right = this.context.createGain(); + + //connections + this.input.connect(this.splitter); + this.splitter.connect(this.left, 0, 0); + this.splitter.connect(this.right, 1, 0); + }; + + Tone.extend(Tone.Split); + + /** + * dispose method + */ + Tone.Split.prototype.dispose = function(){ + this.splitter.disconnect(); + this.input.disconnect(); + this.output.disconnect(); + this.splitter = null; + this.input = null; + this.output = null; + }; + + return Tone.Split; +}); +define('Tone/component/Panner',["Tone/core/Tone", "Tone/component/DryWet", "Tone/signal/Merge", "Tone/signal/Split"], +function(Tone){ + + /** + * Panner. + * + * Equal Power Gain L/R Panner. Not 3D + * + * a panner uses a dry/wet knob internally + * + * 0 = 100% Left + * 1 = 100% Right + * + * @constructor + * @extends {Tone} + * @param {number=} initialPan the initail panner value (defaults to 0.5 = center) + */ + Tone.Panner = function(initialPan){ + + Tone.call(this); + + /** + * the dry/wet knob + * @type {Tone.DryWet} + * @private + */ + this._dryWet = new Tone.DryWet(); + /** + * @type {Tone.Merge} + * @private + */ + this._merger = new Tone.Merge(); + /** + * @type {Tone.Split} + * @private + */ + this._splitter = new Tone.Split(); + /** + * the pan control + * @type {Tone.Signal} + */ + this.pan = this._dryWet.wetness; + + //CONNECTIONS: + this.input.connect(this._splitter.left); + this.input.connect(this._splitter.right); + //left channel is dry, right channel is wet + this._splitter.left.connect(this._dryWet.dry); + this._splitter.right.connect(this._dryWet.wet); + //merge it back together + this._dryWet.dry.connect(this._merger.left); + this._dryWet.wet.connect(this._merger.right); + this._merger.connect(this.output); + + //initial value + this.setPan(this.defaultArg(initialPan, 0.5)); + }; + + Tone.extend(Tone.Panner); + + /** + * set the l/r pan. + * + * 0 = 100% left. + * 1 = 100% right. + * + * @param {number} pan 0-1 + * @param {Tone.Time=} rampTime (optionally) ramp to the pan position + */ + Tone.Panner.prototype.setPan = function(pan, rampTime){ + this._dryWet.setWet(pan, rampTime); + }; + + /** + * clean up + */ + Tone.Panner.prototype.dispose = function(){ + this._dryWet.dispose(); + this._splitter.dispose(); + this._merger.dispose(); + this.input.disconnect(); + this.output.disconnect(); + this._dryWet = null; + this._splitter = null; + this._merger = null; + this.input = null; + this.output = null; + }; + + return Tone.Panner; +}); +define('Tone/component/Recorder',["Tone/core/Tone", "Tone/core/Master"], function(Tone){ + + /** + * Record an input into an array or AudioBuffer + * + * it is limited in that the recording length needs to be known beforehand + * + * @constructor + * @extends {Tone} + * @param {number} channels + */ + Tone.Recorder = function(channels){ + + Tone.call(this); + + /** + * the number of channels in the recording + * @type {number} + */ + this.channels = this.defaultArg(channels, 1); + + /** + * @private + * @type {ScriptProcessorNode} + */ + this._jsNode = this.context.createScriptProcessor(this.bufferSize, this.channels, 1); + this._jsNode.onaudioprocess = this._audioprocess.bind(this); + + /** + * Float32Array for each channel + * @private + * @type {Array<Float32Array>} + */ + this._recordBuffers = new Array(this.channels); + + /** + * @type {number} + * @private + */ + this._recordStartSample = 0; + + /** + * @type {number} + * @private + */ + this._recordEndSample = 0; + + /** + * @type {number} + * @private + */ + this._recordDuration = 0; + + /** + * @type {RecordState} + */ + this.state = RecordState.STOPPED; + + /** + * @private + * @type {number} + */ + this._recordBufferOffset = 0; + + /** + * callback invoked when the recording is over + * @private + * @type {function(Float32Array)} + */ + this._callback = function(){}; + + //connect it up + this.input.connect(this._jsNode); + //pass thru audio + this.input.connect(this.output); + //so it doesn't get garbage collected + this._jsNode.noGC(); + //clear it to start + this.clear(); + }; + + Tone.extend(Tone.Recorder); + + /** + * internal method called on audio process + * + * @private + * @param {AudioProcessorEvent} event + */ + Tone.Recorder.prototype._audioprocess = function(event){ + if (this.state === RecordState.STOPPED){ + return; + } else if (this.state === RecordState.RECORDING){ + //check if it's time yet + var now = this.defaultArg(event.playbackTime, this.now()); + var processPeriodStart = this.toSamples(now); + var bufferSize = this._jsNode.bufferSize; + var processPeriodEnd = processPeriodStart + bufferSize; + var bufferOffset, len; + if (processPeriodStart > this._recordEndSample){ + this.state = RecordState.STOPPED; + this._callback(this._recordBuffers); + } else if (processPeriodStart > this._recordStartSample) { + bufferOffset = 0; + len = Math.min(this._recordEndSample - processPeriodStart, bufferSize); + this._recordChannels(event.inputBuffer, bufferOffset, len, bufferSize); + } else if (processPeriodEnd > this._recordStartSample) { + len = processPeriodEnd - this._recordStartSample; + bufferOffset = bufferSize - len; + this._recordChannels(event.inputBuffer, bufferOffset, len, bufferSize); + } + + } + }; + + /** + * record an input channel + * @param {AudioBuffer} inputBuffer + * @param {number} from + * @param {number} to + * @private + */ + Tone.Recorder.prototype._recordChannels = function(inputBuffer, from, to, bufferSize){ + var offset = this._recordBufferOffset; + var buffers = this._recordBuffers; + for (var channelNum = 0; channelNum < inputBuffer.numberOfChannels; channelNum++){ + var channel = inputBuffer.getChannelData(channelNum); + if ((from === 0) && (to === bufferSize)){ + //set the whole thing + this._recordBuffers[channelNum].set(channel, offset); + } else { + for (var i = from; i < from + to; i++){ + var zeroed = i - from; + buffers[channelNum][zeroed + offset] = channel[i]; + } + } + } + this._recordBufferOffset += to; + }; + + /** + * Record for a certain period of time + * + * will clear the internal buffer before starting + * + * @param {Tone.Time} duration + * @param {Tone.Time} wait the wait time before recording + * @param {function(Float32Array)} callback the callback to be invoked when the buffer is done recording + */ + Tone.Recorder.prototype.record = function(duration, startTime, callback){ + if (this.state === RecordState.STOPPED){ + this.clear(); + this._recordBufferOffset = 0; + startTime = this.defaultArg(startTime, 0); + this._recordDuration = this.toSamples(duration); + this._recordStartSample = this.toSamples("+"+startTime); + this._recordEndSample = this._recordStartSample + this._recordDuration; + for (var i = 0; i < this.channels; i++){ + this._recordBuffers[i] = new Float32Array(this._recordDuration); + } + this.state = RecordState.RECORDING; + this._callback = this.defaultArg(callback, function(){}); + } + }; + + /** + * clears the recording buffer + */ + Tone.Recorder.prototype.clear = function(){ + for (var i = 0; i < this.channels; i++){ + this._recordBuffers[i] = null; + } + this._recordBufferOffset = 0; + }; + + + /** + * true if there is nothing in the buffers + * @return {boolean} + */ + Tone.Recorder.prototype.isEmpty = function(){ + return this._recordBuffers[0] === null; + }; + + /** + * @return {Array<Float32Array>} + */ + Tone.Recorder.prototype.getFloat32Array = function(){ + if (this.isEmpty()){ + return null; + } else { + return this._recordBuffers; + } + }; + + /** + * @return {AudioBuffer} + */ + Tone.Recorder.prototype.getAudioBuffer = function(){ + if (this.isEmpty()){ + return null; + } else { + var audioBuffer = this.context.createBuffer(this.channels, this._recordBuffers[0].length, this.context.sampleRate); + for (var channelNum = 0; channelNum < audioBuffer.numberOfChannels; channelNum++){ + var channel = audioBuffer.getChannelData(channelNum); + channel.set(this._recordBuffers[channelNum]); + } + return audioBuffer; + } + }; + + /** + * clean up + */ + Tone.Recorder.prototype.dispose = function(){ + this.output.disconnect(); + this.input.disconnect(); + this._jsNode.disconnect(); + this._jsNode.onaudioprocess = undefined; + this.output = null; + this.input = null; + this._jsNode = null; + this._recordBuffers = null; + }; + + /** + * @enum {string} + */ + var RecordState = { + STOPPED : "stopped", + SCHEDULED : "scheduled", + RECORDING : "recording" + }; + + return Tone.Recorder; +}); +define('Tone/core/Bus',["Tone/core/Tone"], function(Tone){ + + /** + * buses are another way of routing audio + * + * augments Tone.prototype to include send and recieve + */ + + /** + * All of the routes + * + * @type {Object} + */ + var Buses = {}; + + /** + * send signal to a channel name + * + * @param {string} channelName + * @param {number} amount + * @return {GainNode} + */ + Tone.prototype.send = function(channelName, amount){ + if (!Buses.hasOwnProperty(channelName)){ + Buses[channelName] = this.context.createGain(); + } + var sendKnob = this.context.createGain(); + sendKnob.gain.value = this.defaultArg(amount, 1); + this.chain(this.output, sendKnob, Buses[channelName]); + return sendKnob; + }; + + /** + * recieve the input from the desired channelName to the input gain of 'this' node. + * + * @param {string} channelName + */ + Tone.prototype.receive = function(channelName){ + if (!Buses.hasOwnProperty(channelName)){ + Buses[channelName] = this.context.createGain(); + } + Buses[channelName].connect(this.input); + }; + + Tone.Buses = Buses; + + return Buses; +}); +define('Tone/effect/Effect',["Tone/core/Tone", "Tone/component/DryWet"], function(Tone){ + + /** + * Effect is the base class for effects. connect the effect between + * the effectSend and effectReturn GainNodes. then control the amount of + * effect which goes to the output using the dry/wet control. + * + * @constructor + * @extends {Tone} + * @param {number=} initalDry the starting dry value + * defaults to 0.5 (50% dry / 50% wet) + */ + Tone.Effect = function(initialDry){ + Tone.call(this); + + /** + * the drywet knob to control the amount of effect + * + * @type {Tone.DryWet} + */ + this.dryWet = new Tone.DryWet(); + /** + * connect the effectSend to the input of hte effect + * + * @type {GainNode} + */ + this.effectSend = this.context.createGain(); + /** + * connect the output of the effect to the effectReturn + * + * @type {GainNode} + */ + this.effectReturn = this.context.createGain(); + + //connections + this.input.connect(this.dryWet.dry); + this.input.connect(this.effectSend); + this.effectReturn.connect(this.dryWet.wet); + this.dryWet.connect(this.output); + + //setup + this.setDry(this.defaultArg(initialDry, 0.5)); + }; + + Tone.extend(Tone.Effect); + + /** + * setDry adjusts the dry / wet balance + * dryness is 0 (100% wet) to 1 (100% dry) + * + * @param {number} dryness + * @param {Tone.Time=} rampTime + */ + Tone.Effect.prototype.setDry = function(dryness, rampTime){ + this.dryWet.setDry(dryness, rampTime); + }; + + /** + * setWet also adjusts the dry / wet balance + * wetVal is 0 (100% dry) to 1 (100% wet) + * + * @param {number} wetness + * @param {Tone.Time=} rampTime + */ + Tone.Effect.prototype.setWet = function(wetVal, rampTime){ + this.dryWet.setWet(wetVal, rampTime); + }; + + /** + * bypass the effect + */ + Tone.Effect.prototype.bypass = function(){ + this.setDry(1); + }; + + /** + * chains the effect in between the effectSend and effectReturn + * @param {Tone} effect + */ + Tone.Effect.prototype.connectEffect = function(effect){ + this.chain(this.effectSend, effect, this.effectReturn); + }; + + /** + * tear down + */ + Tone.Effect.prototype.dispose = function(){ + this.dryWet.dispose(); + this.input.disconnect(); + this.output.disconnect(); + this.effectSend.disconnect(); + this.effectReturn.disconnect(); + this.dryWet = null; + this.input = null; + this.output = null; + this.effectSend = null; + this.effectReturn = null; + }; + + return Tone.Effect; +}); +define('Tone/effect/AutoPanner',["Tone/core/Tone", "Tone/effect/Effect", "Tone/component/LFO", "Tone/component/Panner"], function(Tone){ + + /** + * AutoPanner is a Tone.Panner with an LFO connected to the pan amount + * + * @constructor + * @extends {Tone.Effect} + * @param { number= } rate (optional) rate in HZ of the left-right pan + * @param { number= } amount (optional) of the pan (0 - 1) + */ + Tone.AutoPanner = function(rate, amount){ + Tone.Effect.call(this); + + /** + * the lfo which drives the panning + * @type {Tone.LFO} + */ + this.lfo = new Tone.LFO(rate, 0, 1); + + /** + * the panner node which does the panning + * @type {Tone.Panner} + */ + this.panner = new Tone.Panner(); + + //connections + this.connectEffect(this.panner); + this.lfo.connect(this.panner.pan); + //default dry value + this.setDry(this.defaultArg(amount, 1)); + }; + + //extend Effect + Tone.extend(Tone.AutoPanner, Tone.Effect); + + /** + * Start the panner + * + * @param {Tone.Time=} Time the panner begins. + */ + Tone.AutoPanner.prototype.start = function(time){ + this.lfo.start(time); + }; + + /** + * Stop the panner + * + * @param {Tone.Time=} time the panner stops. + */ + Tone.AutoPanner.prototype.stop = function(time){ + this.lfo.stop(time); + }; + + /** + * Set the type of oscillator attached to the AutoPanner. + * + * @param {string} type of oscillator the panner is attached to (sine|sawtooth|triangle|square) + */ + Tone.AutoPanner.prototype.setType = function(type){ + this.lfo.setType(type); + }; + + /** + * Set frequency of the oscillator attached to the AutoPanner. + * + * @param {number|string} rate in HZ of the oscillator's frequency. + */ + Tone.AutoPanner.prototype.setFrequency = function(rate){ + this.lfo.setFrequency(rate); + }; + + /** + * pointer to the parent's dipose method + */ + Tone.AutoPanner.prototype._effectDispose = Tone.Effect.prototype.dispose; + + /** + * clean up + */ + Tone.AutoPanner.prototype.dispose = function(){ + this._effectDispose(); + this.lfo.dispose(); + this.panner.dispose(); + this.lfo = null; + this.panner = null; + }; + + return Tone.AutoPanner; +}); + +define('Tone/effect/FeedbackEffect',["Tone/core/Tone", "Tone/effect/Effect", "Tone/signal/Signal"], function(Tone){ + /** + * Feedback Effect (a sound loop between an audio source and its own output) + * + * @constructor + * @extends {Tone.Effect} + * @param {number=} initialFeedback the initial feedback value (defaults to 0.25) + */ + Tone.FeedbackEffect = function(initialFeedback){ + Tone.Effect.call(this); + + /** + * controls the amount of feedback + * @type {Tone.Signal} + */ + this.feedback = new Tone.Signal(this.defaultArg(initialFeedback, 0.25)); + /** + * the gain which controls the feedback + * @type {GainNode} + * @private + */ + this._feedbackGain = this.context.createGain(); + + //the feedback loop + this.chain(this.effectReturn, this._feedbackGain, this.effectSend); + this.feedback.connect(this._feedbackGain.gain); + }; + + Tone.extend(Tone.FeedbackEffect, Tone.Effect); + + /** + * set the feedback amount + * + * @param {number} value the amount of feedback + * @param {Tone.Time=} rampTime (optionally) set the ramp time it takes + * to reach the new feedback value + */ + Tone.FeedbackEffect.prototype.setFeedback = function(value, rampTime){ + if (rampTime){ + this.feedback.linearRampToValueNow(value, rampTime); + } else { + this.feedback.setValue(value); + } + }; + + /** + * the parents dispose method + * @private + * @borrows Tone.Effect.dispose as Tone.FeedbackEffect._effectDispose + */ + Tone.FeedbackEffect.prototype._effectDispose = Tone.Effect.prototype.dispose; + + /** + * clean up + */ + Tone.FeedbackEffect.prototype.dispose = function(){ + this._effectDispose(); + this.feedback.dispose(); + this._feedbackGain.disconnect(); + this.feedback = null; + this._feedbackGain = null; + }; + + return Tone.FeedbackEffect; +}); + +define('Tone/effect/FeedbackDelay',["Tone/core/Tone", "Tone/effect/FeedbackEffect", "Tone/signal/Signal"], function(Tone){ + /** + * A feedback delay + * + * @constructor + * @extends {Tone.FeedbackEffect} + * @param {Tone.Time=} delayTime + */ + Tone.FeedbackDelay = function(delayTime){ + Tone.FeedbackEffect.call(this); + + /** + * Tone.Signal to control the delay amount + * @type {Tone.Signal} + */ + this.delay = new Tone.Signal(); + /** + * the delay node + * @type {DelayNode} + * @private + */ + this._delayNode = this.context.createDelay(4); + + // connect it up + this.connectEffect(this._delayNode); + this.delay.connect(this._delayNode.delayTime); + //set the initial delay + this.setDelayTime(this.defaultArg(delayTime, 0.25)); + }; + + Tone.extend(Tone.FeedbackDelay, Tone.FeedbackEffect); + + /** + * Sets the delay time + * + * @param {Tone.Time} delayTime + * @param {Tone.Time=} rampTime time it takes to reach the desired delayTime + */ + Tone.FeedbackDelay.prototype.setDelayTime = function(delayTime, rampTime){ + if (rampTime){ + this.delay.linearRampToValueNow(this.toSeconds(delayTime), rampTime); + } else { + this.delay.setValue(this.toSeconds(delayTime)); + } + }; + + /** + * pointer to the feedback effects dispose method + * @borrows Tone.FeedbackDelay._feedbackEffectDispose as Tone.FeedbackEffect.dispose; + */ + Tone.FeedbackDelay.prototype._feedbackEffectDispose = Tone.FeedbackEffect.prototype.dispose; + + /** + * clean up + */ + Tone.FeedbackDelay.prototype.dispose = function(){ + this._feedbackEffectDispose(); + this.delay.dispose(); + this._delayNode.disconnect(); + this._delayNode = null; + this.delay = null; + }; + + return Tone.FeedbackDelay; +}); +define('Tone/effect/PingPongDelay',["Tone/core/Tone", "Tone/effect/FeedbackDelay", "Tone/signal/Split", "Tone/signal/Merge"], function(Tone){ + /** + * PingPongDelay is a dual delay effect where the echo is heard first in one channel and next in the opposite channel + * + * @constructor + * @extends {Tone.Effect} + * @param {Tone.Time=} delayTime is the interval between consecutive echos + */ + Tone.PingPongDelay = function(delayTime){ + Tone.call(this); + + /** + * merge the delayed signal + */ + this._merger = new Tone.Merge(); + /** + * each channel (left/right) gets a feedback delay + * @type {Tone.FeedbackDelay} + */ + this.leftDelay = new Tone.FeedbackDelay(delayTime); + /** + * @type {Tone.FeedbackDelay} + */ + this.rightDelay = new Tone.FeedbackDelay(delayTime); + + //connect it up + this.input.connect(this.leftDelay); + this.input.connect(this.rightDelay); + + //disconnect the feedback lines to connect them to the other delay + // http://jvzaudio.files.wordpress.com/2011/04/delay-f43.gif + this.leftDelay._feedbackGain.disconnect(); + this.rightDelay._feedbackGain.disconnect(); + this.leftDelay._feedbackGain.connect(this.rightDelay.effectSend); + this.rightDelay._feedbackGain.connect(this.leftDelay.effectSend); + + this.leftDelay.connect(this._merger.left); + this.rightDelay.connect(this._merger.right); + + this._merger.connect(this.output); + + //initial vals; + this.setDelayTime(this.defaultArg(delayTime, 0.25)); + }; + + Tone.extend(Tone.PingPongDelay); + + /** + * setDelayTime + * + * @param {Tone.Time} delayTime + */ + Tone.PingPongDelay.prototype.setDelayTime = function(delayTime){ + this.leftDelay.setDelayTime(delayTime); + this.rightDelay.setDelayTime(delayTime * 2); + }; + + /** + * setFeedback + * + * @param {number} feedback (0 - 1) + */ + Tone.PingPongDelay.prototype.setFeedback = function(feedback){ + this.leftDelay.setFeedback(feedback); + this.rightDelay.setFeedback(feedback); + }; + + /** + * setWet + * + * @param {number} wet (0 - 1) + */ + Tone.PingPongDelay.prototype.setWet = function(wet){ + this.leftDelay.setWet(wet); + this.rightDelay.setWet(wet); + }; + + /** + * setDry + * + * @param {number} dry (0 - 1) + */ + Tone.PingPongDelay.prototype.setDry = function(dry){ + this.leftDelay.setDry(dry); + this.rightDelay.setDry(dry); + }; + + return Tone.PingPongDelay; +}); +define('Tone/signal/BitCrusher',["Tone/core/Tone"], function(Tone){ + + /** + * downsample incoming signal + * inspiration from https://github.com/jaz303/bitcrusher/blob/master/index.js + * + * @constructor + * @extends {Tone} + * @param {number=} bits + * @param {number=} frequency + */ + Tone.BitCrusher = function(bits, frequency){ + + Tone.call(this); + + /** + * @private + * @type {number} + */ + this._bits = this.defaultArg(bits, 8); + + /** + * @private + * @type {number} + */ + this._frequency = this.defaultArg(frequency, 0.5); + + /** + * @private + * @type {number} + */ + this._step = 2 * Math.pow(0.5, this._bits); + + /** + * @private + * @type {number} + */ + this._invStep = 1/this._step; + + /** + * @private + * @type {number} + */ + this._phasor = 0; + + /** + * @private + * @type {number} + */ + this._last = 0; + + /** + * @private + * @type {ScriptProcessorNode} + */ + this._crusher = this.context.createScriptProcessor(this.bufferSize, 1, 1); + this._crusher.onaudioprocess = this._audioprocess.bind(this); + + //connect it up + this.chain(this.input, this._crusher, this.output); + }; + + Tone.extend(Tone.BitCrusher); + + /** + * @private + * @param {AudioProcessingEvent} event + */ + Tone.BitCrusher.prototype._audioprocess = function(event){ + //cache the values used in the loop + var phasor = this._phasor; + var freq = this._frequency; + var invStep = this._invStep; + var last = this._last; + var step = this._step; + var input = event.inputBuffer.getChannelData(0); + var output = event.outputBuffer.getChannelData(0); + for (var i = 0, len = output.length; i < len; i++) { + phasor += freq; + if (phasor >= 1) { + phasor -= 1; + last = step * ((input[i] * invStep) | 0 + 0.5); + } + output[i] = last; + } + //set the values for the next loop + this._phasor = phasor; + this._last = last; + }; + + /** + * set the bit rate + * + * @param {number} bits + */ + Tone.BitCrusher.prototype.setBits = function(bits){ + this._bits = bits; + this._step = 2 * Math.pow(0.5, this._bits); + this._invStep = 1/this._step; + }; + + /** + * set the frequency + * @param {number} freq + */ + Tone.BitCrusher.prototype.setFrequency = function(freq){ + this._frequency = freq; + }; + + /** + * clean up + */ + Tone.BitCrusher.prototype.dispose = function(){ + this.input.disconnect(); + this.output.disconnect(); + this._crusher.disconnect(); + this.input = null; + this.output = null; + this._crusher = null; + }; + + return Tone.BitCrusher; +}); +/////////////////////////////////////////////////////////////////////////////// +// +// WEB RTC MICROPHONE +// +/////////////////////////////////////////////////////////////////////////////// + +define('Tone/source/Microphone',["Tone/core/Tone", "Tone/source/Source"], function(Tone){ + + /** + * WebRTC Microphone + * + * CHROME ONLY (for now) because of the + * use of the MediaStreamAudioSourceNode + * + * @constructor + * @extends {Tone.Source} + * @param {number=} inputNum + */ + Tone.Microphone = function(inputNum){ + Tone.Source.call(this); + + /** + * @type {MediaStreamAudioSourceNode} + * @private + */ + this._mediaStream = null; + /** + * @type {LocalMediaStream} + * @private + */ + this._stream = null; + /** + * @type {Object} + * @private + */ + this.constraints = {"audio" : true}; + + //get the option + var self = this; + MediaStreamTrack.getSources(function (media_sources) { + if (inputNum < media_sources.length){ + self.constraints.audio = { + optional : [{ sourceId: media_sources[inputNum].id}] + }; + } + }); + }; + + Tone.extend(Tone.Microphone, Tone.Source); + + /** + * start the stream. + */ + Tone.Microphone.prototype.start = function(){ + if (this.state === Tone.Source.State.STOPPED){ + this.state = Tone.Source.State.STARTED; + navigator.getUserMedia(this.constraints, + this._onStream.bind(this), this._onStreamError.bind(this)); + } + }; + + /** + * stop the stream. + */ + Tone.Microphone.prototype.stop = function(){ + if (this._stream && this.state === Tone.Source.State.STARTED){ + this.state = Tone.Source.State.STOPPED; + this._stream.stop(); + } + }; + + /** + * called when the stream is successfully setup + * @param {LocalMediaStream} stream + * @private + */ + Tone.Microphone.prototype._onStream = function(stream) { + this._stream = stream; + // Wrap a MediaStreamSourceNode around the live input stream. + this._mediaStream = this.context.createMediaStreamSource(stream); + this._mediaStream.connect(this.output); + }; + + /** + * called on error + * @param {Error} e + * @private + */ + Tone.Microphone.prototype._onStreamError = function(e) { + console.error(e); + }; + + /** + * clean up + */ + Tone.Microphone.prototype.dispose = function(e) { + this.input.disconnect(); + this.output.disconnect(); + this._stream.disconnect(); + this._mediaStream.disconnect(); + this.input = null; + this.output = null; + this._stream = null; + this._mediaStream = null; + }; + + //polyfill + navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || + navigator.mozGetUserMedia || navigator.msGetUserMedia; + + return Tone.Microphone; +}); +define('Tone/source/Noise',["Tone/core/Tone", "Tone/source/Source"], function(Tone){ + + var sampleRate = Tone.context.sampleRate; + //two seconds per buffer + var bufferLength = sampleRate * 4; + + /** + * Noise generator. + * + * uses looped noise buffers to save on performance. + * + * @constructor + * @extends {Tone.Source} + * @param {string} type the noise type (white|pink|brown) + */ + Tone.Noise = function(type){ + + Tone.Source.call(this); + + /** + * @private + * @type {AudioBufferSourceNode} + */ + this._source = null; + + /** + * the buffer + * @private + * @type {AudioBuffer} + */ + this._buffer = null; + + /** + * set a callback function to invoke when the sample is over + * + * @type {function} + */ + this.onended = function(){}; + + this.setType(this.defaultArg(type, "white")); + }; + + Tone.extend(Tone.Noise, Tone.Source); + + /** + * set the noise type + * + * @param {string} type the noise type (white|pink|brown) + * @param {Tone.Time} time (optional) time that the set will occur + */ + Tone.Noise.prototype.setType = function(type, time){ + switch (type){ + case "white" : + this._buffer = _whiteNoise; + break; + case "pink" : + this._buffer = _pinkNoise; + break; + case "brown" : + this._buffer = _brownNoise; + break; + default : + this._buffer = _whiteNoise; + } + //if it's playing, stop and restart it + if (this.state === Tone.Source.State.STARTED){ + time = this.toSeconds(time); + //remove the listener + this._source.onended = undefined; + this._stop(time); + this._start(time); + } + }; + + /** + * internal start method + * + * @param {Tone.Time} time + * @private + */ + Tone.Noise.prototype._start = function(time){ + this._source = this.context.createBufferSource(); + this._source.buffer = this._buffer; + this._source.loop = true; + this._source.start(this.toSeconds(time)); + this.chain(this._source, this.output); + this._source.onended = this._onended.bind(this); + }; + + /** + * start the noise at a specific time + * + * @param {Tone.Time} time + */ + Tone.Noise.prototype.start = function(time){ + if (this.state === Tone.Source.State.STOPPED){ + this.state = Tone.Source.State.STARTED; + //make the source + this._start(time); + } + }; + + /** + * internal stop method + * + * @param {Tone.Time} time + * @private + */ + Tone.Noise.prototype._stop = function(time){ + this._source.stop(this.toSeconds(time)); + }; + + + /** + * stop the noise at a specific time + * + * @param {Tone.Time} time + */ + Tone.Noise.prototype.stop = function(time){ + if (this.state === Tone.Source.State.STARTED) { + if (this._buffer && this._source){ + if (!time){ + this.state = Tone.Source.State.STOPPED; + } + this._stop(time); + } + } + }; + + /** + * internal call when the buffer is done playing + * + * @private + */ + Tone.Noise.prototype._onended = function(){ + this.state = Tone.Source.State.STOPPED; + this.onended(); + }; + + /** + * dispose all the components + */ + Tone.Noise.prototype.dispose = function(){ + if (this._source !== null){ + this._source.disconnect(); + this._source = null; + } + this._buffer = null; + this.output.disconnect(); + this.output = null; + }; + + + /////////////////////////////////////////////////////////////////////////// + // THE BUFFERS + // borred heavily from http://noisehack.com/generate-noise-web-audio-api/ + /////////////////////////////////////////////////////////////////////////// + + /** + * static brown noise buffer + * + * @static + * @private + * @type {AudioBuffer} + */ + var _pinkNoise = (function() { + var buffer = Tone.context.createBuffer(2, bufferLength, sampleRate); + for (var channelNum = 0; channelNum < buffer.numberOfChannels; channelNum++){ + var channel = buffer.getChannelData(channelNum); + var b0, b1, b2, b3, b4, b5, b6; + b0 = b1 = b2 = b3 = b4 = b5 = b6 = 0.0; + for (var i = 0; i < bufferLength; i++) { + var white = Math.random() * 2 - 1; + b0 = 0.99886 * b0 + white * 0.0555179; + b1 = 0.99332 * b1 + white * 0.0750759; + b2 = 0.96900 * b2 + white * 0.1538520; + b3 = 0.86650 * b3 + white * 0.3104856; + b4 = 0.55000 * b4 + white * 0.5329522; + b5 = -0.7616 * b5 - white * 0.0168980; + channel[i] = b0 + b1 + b2 + b3 + b4 + b5 + b6 + white * 0.5362; + channel[i] *= 0.11; // (roughly) compensate for gain + b6 = white * 0.115926; + } + } + return buffer; + }()); + + /** + * static brown noise buffer + * + * @static + * @private + * @type {AudioBuffer} + */ + var _brownNoise = (function() { + var buffer = Tone.context.createBuffer(2, bufferLength, sampleRate); + for (var channelNum = 0; channelNum < buffer.numberOfChannels; channelNum++){ + var channel = buffer.getChannelData(channelNum); + var lastOut = 0.0; + for (var i = 0; i < bufferLength; i++) { + var white = Math.random() * 2 - 1; + channel[i] = (lastOut + (0.02 * white)) / 1.02; + lastOut = channel[i]; + channel[i] *= 3.5; // (roughly) compensate for gain + } + } + return buffer; + })(); + + /** + * static white noise buffer + * + * @static + * @private + * @type {AudioBuffer} + */ + var _whiteNoise = (function(){ + var buffer = Tone.context.createBuffer(2, bufferLength, sampleRate); + for (var channelNum = 0; channelNum < buffer.numberOfChannels; channelNum++){ + var channel = buffer.getChannelData(channelNum); + for (var i = 0; i < bufferLength; i++){ + channel[i] = Math.random() * 2 - 1; + } + } + return buffer; + }()); + + return Tone.Noise; +}); +define('Tone/source/Player',["Tone/core/Tone", "Tone/source/Source"], function(Tone){ + + /** + * Audio Player + * + * Audio file player with start, loop, stop. + * + * @constructor + * @extends {Tone.Source} + * @param {string=} url if a url is passed in, it will be loaded + * and invoke the callback if it also passed + * in. + * @param {function(Tone.Player)=} onload callback to be invoked + * once the url is loaded + */ + Tone.Player = function(url, onload){ + Tone.Source.call(this); + + /** + * @private + * @type {AudioBufferSourceNode} + */ + this._source = null; + + /** + * the buffer + * @private + * @type {AudioBuffer} + */ + this._buffer = null; + + + /** + * the duration of the buffer once it's been loaded + * @type {number} + */ + this.duration = 0; + + /** + * the playback rate + * @private + * @type {number} + */ + this._playbackRate = 1; + + /** + * enabling retrigger will allow a player to be restarted + * before the it's is done playing + * + * @type {boolean} + */ + this.retrigger = false; + + /** + * set a callback function to invoke when the sample is over + * + * @type {function} + */ + this.onended = function(){}; + + //if there is a url, load it. + if (url){ + this.load(url, onload); + } + }; + + Tone.extend(Tone.Player, Tone.Source); + + /** + * makes an xhr reqest for the selected url + * Load the audio file as an audio buffer. + * Decodes the audio asynchronously and invokes + * the callback once the audio buffer loads. + * + * @param {string} url the url of the buffer to load. + * filetype support depends on the + * browser. + * @param {function(Tone.Player)=} callback + */ + Tone.Player.prototype.load = function(url, callback){ + if (!this._buffer){ + var request = new XMLHttpRequest(); + request.open("GET", url, true); + request.responseType = "arraybuffer"; + // decode asynchronously + var self = this; + request.onload = function() { + self.context.decodeAudioData(request.response, function(buff) { + self.setBuffer(buff); + if (callback){ + callback(self); + } + }); + }; + //send the request + request.send(); + } else { + if (callback){ + callback(this); + } + } + }; + + /** + * set the buffer + * + * @param {AudioBuffer} buffer the buffer which the player will play. + * note: if you switch the buffer after + * the player is already started, it will not + * take effect until the next time the player + * is started. + */ + Tone.Player.prototype.setBuffer = function(buffer){ + this._buffer = buffer; + this.duration = buffer.duration; + }; + + /** + * play the buffer between the desired positions + * + * @param {Tone.Time=} startTime + * @param {Tone.Time=} offset + * @param {Tone.Time=} duration + */ + Tone.Player.prototype.start = function(startTime, offset, duration){ + if (this.state === Tone.Source.State.STOPPED || this.retrigger){ + if (this._buffer){ + this.state = Tone.Source.State.STARTED; + //default args + offset = this.defaultArg(offset, 0); + duration = this.defaultArg(duration, this._buffer.duration - offset); + //make the source + this._source = this.context.createBufferSource(); + this._source.buffer = this._buffer; + this._source.loop = false; + this._source.playbackRate.value = this._playbackRate; + this._source.start(this.toSeconds(startTime), this.toSeconds(offset), this.toSeconds(duration)); + this._source.onended = this._onended.bind(this); + this.chain(this._source, this.output); + } + } + }; + + /** + * Loop the buffer from start to finish at a time + * + * @param {Tone.Time=} startTime + * @param {Tone.Time=} loopStart + * @param {Tone.Time=} loopEnd + * @param {Tone.Time=} offset + * @param {Tone.Time=} duration + */ + Tone.Player.prototype.loop = function(startTime, loopStart, loopEnd, offset, duration){ + if (this._buffer){ + //default args + loopStart = this.defaultArg(loopStart, 0); + loopEnd = this.defaultArg(loopEnd, this._buffer.duration); + offset = this.defaultArg(offset, loopStart); + duration = this.defaultArg(duration, this._buffer.duration - offset); + //make/play the source + this.start(startTime, offset, duration); + this._source.loop = true; + this._source.loopStart = this.toSeconds(loopStart); + this._source.loopEnd = this.toSeconds(loopEnd); + } + }; + + /** + * Stop playback. + * + * @param {Tone.Time} time + */ + Tone.Player.prototype.stop = function(time){ + if (this.state === Tone.Source.State.STARTED) { + if (this._buffer && this._source){ + if (!time){ + this.state = Tone.Source.State.STOPPED; + } + this._source.stop(this.toSeconds(time)); + } + } + }; + + /** + * set the rate at which the file plays + * + * @param {number} rate + * @param {Tone.Time=} rampTime (optional) the amount of time it takes to + * reach the rate + */ + Tone.Player.prototype.setPlaybackRate = function(rate, rampTime){ + this._playbackRate = rate; + if (this._source) { + if (rampTime){ + this._source.playbackRate.exponentialRampToValueAtTime(rate, this.toSeconds(rampTime)); + } else { + this._source.playbackRate.value = rampTime; + } + } + }; + + /** + * internal call when the buffer is done playing + * + * @private + */ + Tone.Player.prototype._onended = function(){ + this.state = Tone.Source.State.STOPPED; + this.onended(); + }; + + /** + * dispose and disconnect + */ + Tone.Player.prototype.dispose = function(){ + if (this._source !== null){ + this._source.disconnect(); + this._source = null; + } + this._buffer = null; + this.output.disconnect(); + this.output = null; + }; + + return Tone.Player; +}); @@ -556,7 +4427,7 @@ define("Tone/core/Tone", [], function(){
- Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:09 GMT-0400 (EDT). diff --git a/doc/Transport.js.html b/doc/Transport.js.html deleted file mode 100644 index 22727cdf..00000000 --- a/doc/Transport.js.html +++ /dev/null @@ -1,1107 +0,0 @@ - - - - - - Tone.js Source: core/Transport.js - - - - - - - - - - -
- - -
- - -
- -
- - - -

Source: core/Transport.js

- -
-
-
define(["Tone/core/Tone", "Tone/core/Master", "Tone/signal/Signal"], 
-function(Tone){
-
-	/**
-	 *  oscillator-based transport allows for simple musical timing
-	 *  supports tempo curves and time changes
-	 *
-	 *  @constructor
-	 *  @extends {Tone}
-	 */
-	Tone.Transport = function(){
-
-		/**
-		 *  watches the main oscillator for timing ticks
-		 *  
-		 *  @private
-		 *  @type {ScriptProcessorNode}
-		 */
-		this._jsNode = this.context.createScriptProcessor(this.bufferSize, 1, 1);
-		this._jsNode.onaudioprocess = this._processBuffer.bind(this);
-
-		/** 
-		 *  @type {boolean}
-		 */
-		this.loop = false;
-
-		/**
-		 *  @type {TransportState}
-		 */
-		this.state = TransportState.STOPPED;
-
-		//so it doesn't get garbage collected
-		this._jsNode.noGC();
-	};
-
-	Tone.extend(Tone.Transport);
-
-	/** 
-	 * @private 
-	 * @type {number} 
-	 */
-	var timelineTicks = 0;
-	/** 
-	 * @private 
-	 * @type {number} 
-	 */
-	var transportTicks = 0;
-	/** 
-	 * @private
-	 * @type {number}
-	 */
-	var tatum = 12;
-	/** 
-	 * @private
-	 * @type {Boolean}
-	 */
-	var upTick = false;
-	/** 
-	 * @private
-	 * @type {number}
-	 */
-	var transportTimeSignature = 4;
-
-	/** 
-	 * @private
-	 * @type {number}
-	 */
-	var loopStart = 0;
-	/** 
-	 * @private
-	 * @type {number}
-	 */
-	var loopEnd = tatum * 4;
-
-	/** 
-	 * @private
-	 * @type {Array}
-	 */
-	var intervals = [];
-	
-	/** 
-	 * @private
-	 * @type {Array}
-	 */
-	var timeouts = [];
-	
-	/** 
-	 * @private
-	 * @type {Array}
-	 */
-	var transportTimeline = [];
-	
-	/** 
-	 * @private
-	 * @type {number}
-	 */
-	var timelineProgress = 0;
-
-	/**
-	 *  The main oscillator for the system
-	 *  @private
-	 *  @type {OscillatorNode}
-	 */
-	var oscillator = null;
-
-	/** 
-	 *  controls the oscillator frequency
-	 *  starts at 120bpm
-	 *  
-	 *  @private
-	 *  @type {Tone.Signal}
-	 */
-	var controlSignal = new Tone.Signal(24);
-
-	/** 
-	 *  All of the synced components
-	 *  @private 
-	 *  @type {Array<Tone>}
-	 */
-	var SyncedComponents = [];
-
-
-	/**
-	 *  @enum
-	 */
-	 var TransportState = {
-	 	STARTED : "started",
-	 	PAUSED : "paused",
-	 	STOPPED : "stopped"
-	 };
-
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	JS NODE PROCESSING
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  called when a buffer is ready
-	 *  	
-	 *  @param  {AudioProcessingEvent} event
-	 */
-	Tone.Transport.prototype._processBuffer = function(event){
-		var now = this.defaultArg(event.playbackTime, this.now());
-		var bufferSize = this._jsNode.bufferSize;
-		var incomingBuffer = event.inputBuffer.getChannelData(0);
-		for (var i = 0; i < bufferSize; i++){
-			var sample = incomingBuffer[i];
-			if (sample > 0 && !upTick){
-				upTick = true;	
-				this._processTick(now + this.samplesToSeconds(i));
-			} else if (sample < 0 && upTick){
-				upTick = false;
-			}
-		}
-	};
-
-	//@param {number} tickTime
-	Tone.Transport.prototype._processTick = function(tickTime){
-		if (oscillator !== null){
-			processIntervals(tickTime);
-			processTimeouts(tickTime);
-			processTimeline(tickTime);
-			transportTicks += 1;
-			timelineTicks += 1;
-			if (this.loop){
-				if (timelineTicks === loopEnd){
-					this._setTicks(loopStart);
-				}
-			}
-		}
-	};
-
-	//jump to a specific tick in the timeline
-	Tone.Transport.prototype._setTicks = function(ticks){
-		timelineTicks = ticks;
-		for (var i = 0; i < transportTimeline.length; i++){
-			var timeout = transportTimeline[i];
-			if (timeout.callbackTick() >= ticks){
-				timelineProgress = i;
-				break;
-			}
-		}
-	};
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	EVENT PROCESSING
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  process the intervals
-	 *  @param  {number} time 
-	 */
-	var processIntervals = function(time){
-		for (var i = 0, len = intervals.length; i<len; i++){
-			var interval = intervals[i];
-			if (interval.testInterval(transportTicks)){
-				interval.doCallback(time);
-			}
-		}
-	};
-
-	/**
-	 *  process the timeouts
-	 *  @param  {number} time 
-	 */
-	var processTimeouts = function(time){
-		var removeTimeouts = 0;
-		for (var i = 0, len = timeouts.length; i<len; i++){
-			var timeout = timeouts[i];
-			var callbackTick = timeout.callbackTick();
-			if (callbackTick <= transportTicks){
-				timeout.doCallback(time);
-				removeTimeouts++;
-			} else if (callbackTick > transportTicks){
-				break;
-			} 
-		}
-		//remove the timeouts off the front of the array after they've been called
-		timeouts.splice(0, removeTimeouts);
-	};
-
-	/**
-	 *  process the transportTimeline events
-	 *  @param  {number} time 
-	 */
-	var processTimeline = function(time){
-		for (var i = timelineProgress, len = transportTimeline.length; i<len; i++){
-			var evnt = transportTimeline[i];
-			var callbackTick = evnt.callbackTick();
-			if (callbackTick === timelineTicks){
-				evnt.doCallback(time);
-				timelineProgress = i;
-			} else if (callbackTick > timelineTicks){
-				break;
-			} 
-		}
-	};
-
-	/**
-	 *  clear the timeouts and intervals
-	 */
-	function clearTimelineEvents(){
-		
-		intervals = [];
-	}
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	INTERVAL
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  intervals are recurring events 
-	 *  
-	 *  @param {function} callback
-	 *  @param {Tone.Time}   interval 
-	 *  @param {Object}   ctx  the context the function is invoked in
-	 *  @return {number} the id of the interval
-	 */
-	Tone.Transport.prototype.setInterval = function(callback, interval, ctx){
-		var tickTime = this.toTicks(interval);
-		var timeout = new TimelineEvent(callback, ctx, tickTime, transportTicks);
-		intervals.push(timeout);
-		return timeout.id;
-	};
-
-	/**
-	 *  clear an interval from the processing array
-	 *  @param  {number} rmInterval 	the interval to remove
-	 *  @return {boolean}            	true if the event was removed
-	 */
-	Tone.Transport.prototype.clearInterval = function(rmInterval){
-		for (var i = 0; i < intervals.length; i++){
-			var interval = intervals[i];
-			if (interval.id === rmInterval){
-				intervals.splice(i, 1);
-				return true;
-			}
-		}
-		return false;
-	};
-
-	/**
-	 *  removes all of the intervals that are currently set
-	 */
-	Tone.Transport.prototype.clearIntervals = function(){
-		intervals = [];
-	};
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	TIMEOUT
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  set a timeout to occur after time from now
-	 *  
-	 *  @param {function} callback 
-	 *  @param {Tone.Time}   time     
-	 *  @param {Object}   ctx      the context to invoke the callback in
-	 *  @return {number} the id of the timeout for clearing timeouts
-	 */
-	Tone.Transport.prototype.setTimeout = function(callback, time, ctx){
-		var ticks = this.toTicks(time);
-		var timeout = new TimelineEvent(callback, ctx, ticks + transportTicks, 0);
-		//put it in the right spot
-		for (var i = 0, len = timeouts.length; i<len; i++){
-			var testEvnt = timeouts[i];
-			if (testEvnt.callbackTick() > timeout.callbackTick()){
-				timeouts.splice(i, 0, timeout);
-				return timeout.id;
-			}
-		}
-		//otherwise push it on the end
-		timeouts.push(timeout);
-		return timeout.id;
-	};
-
-	/**
-	 *  clear the timeout based on it's ID
-	 *  @param  {number} timeoutID 
-	 *  @return {boolean}           true if the timeout was removed
-	 */
-	Tone.Transport.prototype.clearTimeout = function(timeoutID){
-		for (var i = 0; i < timeouts.length; i++){
-			var testTimeout = timeouts[i];
-			if (testTimeout.id === timeoutID){
-				timeouts.splice(i, 1);
-				return true;
-			}
-		}
-		return false;
-	};
-
-	/**
-	 *  removes all of the timeouts that are currently set
-	 *
-	 *  @todo (optionally) remove events after a certain time
-	 */
-	Tone.Transport.prototype.clearTimeouts = function(){
-		timeouts = [];
-	};
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	TIMELINE
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  Timeline events are synced to the transportTimeline of the Transport
-	 *  Unlike Timeout, Timeline events will restart after the 
-	 *  Transport has been stopped and restarted. 
-	 *
-	 *  
-	 *  @param {function} 	callback 	
-	 *  @param {Tome.Time}  timeout  
-	 *  @param {Object}   	ctx      	the context in which the funtion is called
-	 *  @return {number} 				the id for clearing the transportTimeline event
-	 */
-	Tone.Transport.prototype.setTimeline = function(callback, timeout, ctx){
-		var ticks = this.toTicks(timeout);
-		var timelineEvnt = new TimelineEvent(callback, ctx, ticks, 0);
-		//put it in the right spot
-		for (var i = timelineProgress, len = transportTimeline.length; i<len; i++){
-			var testEvnt = transportTimeline[i];
-			if (testEvnt.callbackTick() > timelineEvnt.callbackTick()){
-				transportTimeline.splice(i, 0, timelineEvnt);
-				return timelineEvnt.id;
-			}
-		}
-		//otherwise push it on the end
-		transportTimeline.push(timelineEvnt);
-		return timelineEvnt.id;
-	};
-
-	/**
-	 *  clear the transportTimeline event from the 
-	 *  @param  {number} timelineID 
-	 *  @return {boolean} true if it was removed
-	 */
-	Tone.Transport.prototype.clearTimeline = function(timelineID){
-		for (var i = 0; i < transportTimeline.length; i++){
-			var testTimeline = transportTimeline[i];
-			if (testTimeline.id === timelineID){
-				transportTimeline.splice(i, 1);
-				return true;
-			}
-		}
-		return false;
-	};
-
-	/**
-	 *  remove all events from the timeline
-	 */
-	Tone.Transport.prototype.clearTimelines = function(){
-		timelineProgress = 0;
-		transportTimeline = [];
-	};
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	TIME CONVERSIONS
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  turns the time into
-	 *  @param  {Tone.Time} time
-	 *  @return {number}      
-	 */
-	Tone.Transport.prototype.toTicks = function(time){
-		//get the seconds
-		var seconds = this.toSeconds(time);
-		var quarter = this.notationToSeconds("4n");
-		var quarters = seconds / quarter;
-		var tickNum = quarters * tatum;
-		//quantize to tick value
-		return Math.round(tickNum);
-	};
-
-	/**
-	 *  get the transport time
-	 *  @return {string} in transportTime format (measures:beats:sixteenths)
-	 */
-	Tone.Transport.prototype.getTransportTime = function(){
-		var quarters = timelineTicks / tatum;
-		var measures = Math.floor(quarters / transportTimeSignature);
-		var sixteenths = Math.floor((quarters % 1) * 4);
-		quarters = Math.floor(quarters) % transportTimeSignature;
-		var progress = [measures, quarters, sixteenths];
-		return progress.join(":");
-	};
-
-	/**
-	 *  set the transport time, jump to the position right away
-	 *  	
-	 *  @param {Tone.Time} progress 
-	 */
-	Tone.Transport.prototype.setTransportTime = function(progress){
-		var ticks = this.toTicks(progress);
-		this._setTicks(ticks);
-	};
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	START/STOP/PAUSE
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  start the transport and all sources synced to the transport
-	 *  
-	 *  @param  {Tone.Time} time
-	 */
-	Tone.Transport.prototype.start = function(time){
-		if (this.state === TransportState.STOPPED || this.state === TransportState.PAUSED){
-			this.state = TransportState.STARTED;
-			//reset the oscillator
-			oscillator = this.context.createOscillator();
-			oscillator.type = "square";
-			oscillator.connect(this._jsNode);
-			//connect it up
-			controlSignal.connect(oscillator.frequency);
-			oscillator.frequency.value = 0;
-			upTick = false;
-			oscillator.start(this.toSeconds(time));
-
-			//call start on each of the synced sources
-		}
-	};
-
-
-	/**
-	 *  stop the transport and all sources synced to the transport
-	 *  
-	 *  @param  {Tone.Time} time
-	 */
-	Tone.Transport.prototype.stop = function(time){
-		if (this.state === TransportState.STARTED || this.state === TransportState.PAUSED){
-			this.state = TransportState.STOPPED;
-			oscillator.stop(this.toSeconds(time));
-			oscillator = null;
-			this._setTicks(0);
-			this.clearTimeouts();
-			this.clearIntervals();
-
-			//call stop on each of the synced sources
-		}
-	};
-
-	/**
-	 *  pause the transport and all sources synced to the transport
-	 *  
-	 *  @param  {Tone.Time} time
-	 */
-	Tone.Transport.prototype.pause = function(time){
-		if (this.state === TransportState.STARTED){
-			this.state = TransportState.PAUSED;
-			oscillator.stop(this.toSeconds(time));
-			oscillator = null;
-			clearTimelineEvents();
-			//call pause on each of the synced sources
-		}
-	};
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	SETTERS/GETTERS
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  set the BPM
-	 *  optionally ramp to the bpm over some time
-	 *  @param {number} bpm   
-	 *  @param {Tone.Time=} rampTime 
-	 */
-	Tone.Transport.prototype.setBpm = function(bpm, rampTime){
-		//convert the bpm to frequency
-		var tatumFreq = this.secondsToFrequency(this.notationToSeconds(tatum.toString() + "n", bpm, transportTimeSignature));
-		// var tatumFreq = this.toFrequency(tatum.toString() + "n", bpm, transportTimeSignature);
-		var freqVal = 4 * tatumFreq;
-		if (!rampTime){
-			controlSignal.cancelScheduledValues(0);
-			controlSignal.setValue(freqVal);
-		} else {
-			controlSignal.exponentialRampToValueNow(freqVal, rampTime);
-		}
-	};
-
-	/**
-	 *  return the current BPM
-	 *  
-	 *  @return {number} 
-	 */
-	Tone.Transport.prototype.getBpm = function(){
-		//convert the current frequency of the oscillator to bpm
-		var freq = controlSignal.getValue();
-		return 60 * (freq / tatum);
-	};
-
-	/**
-	 *  set the time signature
-	 *  
-	 *  @example
-	 *  this.setTimeSignature(4); //for 4/4
-	 *  
-	 *  @param {number} numerator   
-	 *  @param {number=} denominator defaults to 4
-	 */
-	Tone.Transport.prototype.setTimeSignature = function(numerator, denominator){
-		denominator = this.defaultArg(denominator, 4);
-		transportTimeSignature = numerator / (denominator / 4);
-	};
-
-	/**
-	 *  return the time signature as just the numerator
-	 *  over 4 is assumed. 
-	 *  for example 4/4 would return 4 and 6/8 would return 3
-	 *  
-	 *  @return {number} 
-	 */
-	Tone.Transport.prototype.getTimeSignature = function(){
-		return transportTimeSignature;
-	};
-
-	/**
-	 *  set the loop start position
-	 *  
-	 *  @param {Tone.Time} startPosition
-	 */
-	Tone.Transport.prototype.setLoopStart = function(startPosition){
-		loopStart = this.toTicks(startPosition);
-	};
-
-	/**
-	 *  set the loop start position
-	 *  
-	 *  @param {Tone.Time} endPosition
-	 */
-	Tone.Transport.prototype.setLoopEnd = function(endPosition){
-		loopEnd = this.toTicks(endPosition);
-	};
-
-	/**
-	 *  shorthand loop setting
-	 *  @param {Tone.Time} startPosition 
-	 *  @param {Tone.Time} endPosition   
-	 */
-	Tone.Transport.prototype.setLoopPoint = function(startPosition, endPosition){
-		this.setLoopStart(startPosition);
-		this.setLoopEnd(endPosition);
-	};
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	SYNCING
-	///////////////////////////////////////////////////////////////////////////////
-	
-
-	Tone.Transport.prototype.sync = function(source, controlSignal){
-		//create a gain node, attach it to the control signal
-		// var ratio = new Tone.Multiply();
-		// controlSignal.connect(ratio);
-		// return ratio;
-	};
-
-	/**
-	 *  remove the source from the list of Synced Sources
-	 *  
-	 *  @param  {Tone.Source} source [description]
-	 */
-	Tone.Transport.prototype.unsync = function(source){
-		
-	};
-
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	TIMELINE EVENT
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  @static
-	 *  @type {number}
-	 */
-	var TimelineEventIDCounter = 0;
-
-	/**
-	 *  A Timeline event
-	 *
-	 *  @constructor
-	 *  @param {function(number)} callback   
-	 *  @param {Object}   context    
-	 *  @param {number}   tickTime
- 	 *  @param {number}   startTicks
-	 */
-	var TimelineEvent = function(callback, context, tickTime, startTicks){
-		this.startTicks = startTicks;
-		this.tickTime = tickTime;
-		this.callback = callback;
-		this.context = context;
-		this.id = TimelineEventIDCounter++;
-	};
-	
-	/**
-	 *  invoke the callback in the correct context
-	 *  passes in the playback time
-	 *  
-	 *  @param  {number} playbackTime 
-	 */
-	TimelineEvent.prototype.doCallback = function(playbackTime){
-		this.callback.call(this.context, playbackTime); 
-	};
-
-	/**
-	 *  get the tick which the callback is supposed to occur on
-	 *  
-	 *  @return {number} 
-	 */
-	TimelineEvent.prototype.callbackTick = function(){
-		return this.startTicks + this.tickTime;
-	};
-
-	/**
-	 *  test if the tick occurs on the interval
-	 *  
-	 *  @param  {number} tick 
-	 *  @return {boolean}      
-	 */
-	TimelineEvent.prototype.testInterval = function(tick){
-		return (tick - this.startTicks) % this.tickTime === 0;
-	};
-
-
-	///////////////////////////////////////////////////////////////////////////////
-	//	AUGMENT TONE'S PROTOTYPE TO INCLUDE TRANSPORT TIMING
-	///////////////////////////////////////////////////////////////////////////////
-
-	/**
-	 *  tests if a string is musical notation
-	 *  i.e.:
-	 *  	4n = quarter note
-	 *   	2m = two measures
-	 *    	8t = eighth-note triplet
-	 *  
-	 *  @return {boolean} 
-	 *  @method isNotation
-	 *  @lends Tone.prototype.isNotation
-	 */
-	Tone.prototype.isNotation = (function(){
-		var notationFormat = new RegExp(/[0-9]+[mnt]$/i);
-		return function(note){
-			return notationFormat.test(note);
-		};
-	})();
-
-	/**
-	 *  tests if a string is transportTime
-	 *  i.e. :
-	 *  	1:2:0 = 1 measure + two quarter notes + 0 sixteenth notes
-	 *  	
-	 *  @return {boolean} 
-	 *  
-	 *  @lends Tone.prototype.isTransportTime
-	 */
-	Tone.prototype.isTransportTime = (function(){
-		var transportTimeFormat = new RegExp(/^\d+(\.\d+)?:\d+(\.\d+)?(:\d+(\.\d+)?)?$/);
-		return function(transportTime){
-			return transportTimeFormat.test(transportTime);
-		};
-	})();
-
-	/**
-	 *  true if the input is in the format number+hz
-	 *  i.e.: 10hz
-	 *
-	 *  @param {number} freq 
-	 *  @return {boolean} 
-	 *
-	 *  @lends Tone.prototype.isFrequency
-	 */
-	Tone.prototype.isFrequency = (function(){
-		var freqFormat = new RegExp(/[0-9]+hz$/i);
-		return function(freq){
-			return freqFormat.test(freq);
-		};
-	})();
-
-
-	/**
-	 *
-	 *  convert notation format strings to seconds
-	 *  @param  {string} notation     
-	 *  @param {number=} bpm 
-	 *  @param {number=} timeSignature 
-	 *  @return {number} 
-	 *                
-	 */
-	Tone.prototype.notationToSeconds = function(notation, bpm, timeSignature){
-		bpm = this.defaultArg(bpm, Tone.Transport.getBpm());
-		timeSignature = this.defaultArg(timeSignature, transportTimeSignature);
-		var beatTime = (60 / bpm);
-		var subdivision = parseInt(notation, 10);
-		var beats = 0;
-		if (subdivision === 0){
-			beats = 0;
-		}
-		var lastLetter = notation.slice(-1);
-		if (lastLetter === "t"){
-			beats = (4 / subdivision) * 2/3;
-		} else if (lastLetter === "n"){
-			beats = 4 / subdivision;
-		} else if (lastLetter === "m"){
-			beats = subdivision * timeSignature;
-		} else {
-			beats = 0;
-		}
-		return beatTime * beats;
-	};
-
-	/**
-	 *  convert transportTime into seconds
-	 *  
-	 *  ie: 4:2:3 == 4 measures + 2 quarters + 3 sixteenths
-	 *
-	 *  @param  {string} transportTime 
-	 *  @param {number=} bpm 
-	 *  @param {number=} timeSignature
-	 *  @return {number}               seconds
-	 *
-	 *  @lends Tone.prototype.transportTimeToSeconds
-	 */
-	Tone.prototype.transportTimeToSeconds = function(transportTime, bpm, timeSignature){
-		bpm = this.defaultArg(bpm, Tone.Transport.getBpm());
-		timeSignature = this.defaultArg(timeSignature, transportTimeSignature);
-		var measures = 0;
-		var quarters = 0;
-		var sixteenths = 0;
-		var split = transportTime.split(":");
-		if (split.length === 2){
-			measures = parseFloat(split[0]);
-			quarters = parseFloat(split[1]);
-		} else if (split.length === 1){
-			quarters = parseFloat(split[0]);
-		} else if (split.length === 3){
-			measures = parseFloat(split[0]);
-			quarters = parseFloat(split[1]);
-			sixteenths = parseFloat(split[2]);
-		}
-		var beats = (measures * timeSignature + quarters + sixteenths / 4);
-		return beats * this.notationToSeconds("4n");
-	};
-
-	/**
-	 *  Convert seconds to the closest transportTime in the form 
-	 *  	measures:quarters:sixteenths
-	 *
-	 *  @method toTransportTime
-	 *  
-	 *  @param {Tone.Time} seconds 
-	 *  @param {number=} bpm 
-	 *  @param {number=} timeSignature
-	 *  @return {string}  
-	 *  
-	 *  @lends Tone.prototype.toTransportTime
-	 */
-	Tone.prototype.toTransportTime = function(time, bpm, timeSignature){
-		var seconds = this.toSeconds(time, bpm, timeSignature);
-		bpm = this.defaultArg(bpm, Tone.Transport.getBpm());
-		timeSignature = this.defaultArg(timeSignature, transportTimeSignature);
-		var quarterTime = this.notationToSeconds("4n");
-		var quarters = seconds / quarterTime;
-		var measures = Math.floor(quarters / timeSignature);
-		var sixteenths = Math.floor((quarters % 1) * 4);
-		quarters = Math.floor(quarters) % timeSignature;
-		var progress = [measures, quarters, sixteenths];
-		return progress.join(":");
-	};
-
-	/**
-	 *  convert a time to a frequency
-	 *  	
-	 *  @param  {Tone.Time} time 
-	 *  @return {number}      the time in hertz
-	 */
-	Tone.prototype.toFrequency = function(time, now){
-		if (this.isFrequency(time)){
-			return parseFloat(time);
-		} else if (this.isNotation(time) || this.isTransportTime(time)) {
-			return this.secondsToFrequency(this.toSeconds(time, now));
-		} else {
-			return time;
-		}
-	};
-
-	/**
-	 *  convert Tone.Time into seconds.
-	 *  
-	 *  unlike the method which it overrides, this takes into account 
-	 *  transporttime and musical notation
-	 *
-	 *  @override
-	 *  @param  {Tone.Time} time       
-	 *  @param {number=} 	now 	if passed in, this number will be 
-	 *                        		used for all 'now' relative timings
-	 *  @return {number} 
-	 */
-	Tone.prototype.toSeconds = function(time, now){
-		now = this.defaultArg(now, this.now());
-		if (typeof time === "number"){
-			return time; //assuming that it's seconds
-		} else if (typeof time === "string"){
-			var plusTime = 0;
-			if(time.charAt(0) === "+") {
-				plusTime = now;
-				time = time.slice(1);				
-			} 
-			if (this.isNotation(time)){
-				time = this.notationToSeconds(time);
-			} else if (this.isTransportTime(time)){
-				time = this.transportTimeToSeconds(time);
-			} else if (this.isFrequency(time)){
-				time = this.frequencyToSeconds(time);
-			} else {
-				time = parseFloat(time);
-			}
-			return time + plusTime;
-		} else {
-			return now;
-		}
-	};
-
-	//a single transport object
-	Tone.Transport = new Tone.Transport();
-
-	return Tone.Transport;
-});
-
-
-
- - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/classes.list.html b/doc/classes.list.html index 3d6c0e59..4f11268b 100644 --- a/doc/classes.list.html +++ b/doc/classes.list.html @@ -311,7 +311,7 @@
- Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). + Documentation generated on Mon Jun 23 2014 15:23:09 GMT-0400 (EDT). diff --git a/doc/global.html b/doc/global.html deleted file mode 100644 index 67d1882b..00000000 --- a/doc/global.html +++ /dev/null @@ -1,539 +0,0 @@ - - - - - - Tone.js Global - - - - - - - - - - -
- - -
- - -
- -
- - - -

Global

-
- -
-

- -

- -
- -
-
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-

toTransportTime(seconds, bpm, timeSignature) → {string}

- - -
-
- - -
-

Convert seconds to the closest transportTime in the form - measures:quarters:sixteenths

-
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
seconds - - -Tone.Time - - - - - - - - - -
bpm - - -number - - - - - - <optional>
- - - - - -
timeSignature - - -number - - - - - - <optional>
- - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -string - - -
-
- - - - - -
- -
- - - - - -
- -
- - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:33:17 GMT-0400 (EDT). - -
-
- - -
-
-
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/doc/index.html b/doc/index.html deleted file mode 100644 index 3043cee7..00000000 --- a/doc/index.html +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - Tone.js Index - - - - - - - - - - -
- - -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - -
-

Tone.js

-

A collection of building blocks extending and wrapping the Web Audio API.

-

Installation

-

Tone.js can be used with or without RequireJS

-

RequireJS

-

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 load the modules used in your code.

-

There are a couple ways to use the tone library with require.js and r.js.

-

The best way to use with Tone.js is to make a path to the base directory:

-
require.config({
-    baseUrl: './base',
-    paths: {
-        "Tone" : "pathto/Tone.js/Tone"
-    }
-});
-

without RequireJS

-

Tone.js can also be used without RequireJS. If you include the Tone.js Build -as a script tag at the top of your page, a global called Tone will be added to the window.

-
<script type="text/javascript" src="pathto/Tone.js"></script>
-

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 Node in the Tone library as this.context. For AudioNodes -to be able to connect together, they need to be created from the same AudioContext.

-

Audio Sources

-

Tone.js simplifies the creation of oscillators and buffer players.

-
//a square wave at 440hz:
-var osc = new Tone.Oscillator(440, "square");
-//connect it to the master output
-osc.toMaster();
-osc.start();
-
//a buffer player which plays as soon as it's loaded
-//the second argument is an onload callback
-var player = new Tone.Player("./sound.mp3", function(){
-    player.start();    
-});
-player.toMaster();
-

Transport and Timing

-

A unique feature of the library is the oscillator-based Transport which allows for simple synchronization of -sources and signals. The Transport allows you to register callbacks at precise moments along and get a callback -with the exact time requested. Pass the time to the Node you'd like to start or automate.

-
//this will start the player on every quarter note
-Tone.Transport.setInterval(function(time){
-    player.start(time);
-}, "4n");
-//start the Transport for the events to start
-Tone.Transport.start();
-

The Transport also allows single events to occur in the future using setTimeout

-
//this will start an oscillator 5 seconds from now
-Tone.Transport.setTimeout(function(time){
-    osc.start(time);
-}, 5);
-Tone.Transport.start();
-

Events can also be arranged on a timeline. Callbacks registered with setTimeline will -repeat even after the Transport is started, stopped or looped.

-
//this will start an oscillator 5 seconds from now
-Tone.Transport.setTimeline(function(time){
-    console.log("first measure")
-}, "1:0:0");
-Tone.Transport.setLoopEnd("4:0:0");
-Tone.Transport.start();
-

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 any of these forms:

-

Number: these will be taken literally as the time (in seconds).

-

Notation: describes time in BPM and time signature relative values.

-
    -
  • "4n" = quarter note
  • -
  • "8t" = eighth note triplet
  • -
  • "2m" = two measures
  • -
-

Transport Time: will also provide tempo and time signature relative times in the form BARS:QUARTERS:SIXTEENTHS.

-
    -
  • "32:0:0" = start of the 32nd measure.
  • -
  • "4:3:2" = 4 bars + 3 quarter notes + 2 sixteenth notes.
  • -
-

Frequency: seconds can also be described in Hz.

-
    -
  • "1hz" = 1 second
  • -
  • "5hz" = 0.2 seconds
  • -
-

Now-Relative: prefix any of the above with "+" and it will be interpreted as "the current time + "

-
    -
  • "+1m" = 1 measure from now
  • -
  • "+0.5" = half a second from now
  • -
-

Components

-

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

- -

Control Signals

-

Like the underlying Web Audio API, Tone.js is built to work with audio-rate signal control of many parameters. -This is a powerful feature which allows for sample-accurate synchronization of multiple parameters with a single -signal and also lets you connect an LFO to nearly anything.

-
//use the same LFO to create a vibrato on a oscillator and pan the audio L/R
-var lfo = new Tone.LFO(3, 0, 1); //3hz signal between 0-1
-
-var panner = new Tone.Panner();
-lfo.connect(panner.pan); //connect the lfo to the signal which controls panning
-
-var scaler = new Tone.Scale(420, 460); //scale the lfo signal from 0-1 to 420-460
-var osc = new Tone.Oscillator(440, "sine"); //create an oscillator
-
-//route the lfo through the scaler to the oscillator frequency
-lfo.connect(scaler);
-scaler.connect(osc.frequency);
-
-//connect the oscillator to the panner and the panner to master
-osc.connect(panner);
-panner.toMaster();
-
-//start the oscillator and the lfo
-lfo.start();
-osc.start();
-

Examples

-

More examples can be found here.

-

Documentation

-

JSDocs are here.

-
- - - - - - - -
- -
-
- - - - Tone No Tone Copyright © 2014. - -
- - - Documentation generated on Mon Jun 23 2014 14:51:30 GMT-0400 (EDT). - -
-
- - -
-
-
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/doc/scripts/linenumber.js b/doc/scripts/linenumber.js deleted file mode 100644 index 613865d0..00000000 --- a/doc/scripts/linenumber.js +++ /dev/null @@ -1,17 +0,0 @@ -(function() { - var counter = 0; - var numbered; - var source = document.getElementsByClassName('prettyprint source'); - - if (source && source[0]) { - source = source[0].getElementsByTagName('code')[0]; - - numbered = source.innerHTML.split('\n'); - numbered = numbered.map(function(item) { - counter++; - return '' + item; - }); - - source.innerHTML = numbered.join('\n'); - } -})(); diff --git a/doc/styles/jsdoc-default.css b/doc/styles/jsdoc-default.css deleted file mode 100644 index 7afd6850..00000000 --- a/doc/styles/jsdoc-default.css +++ /dev/null @@ -1,290 +0,0 @@ -html -{ - overflow: auto; - background-color: #fff; -} - -body -{ - font: 14px "DejaVu Sans Condensed", "Liberation Sans", "Nimbus Sans L", Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans serif; - line-height: 130%; - color: #000; - background-color: #fff; -} - -a { - color: #444; -} - -a:visited { - color: #444; -} - -a:active { - color: #444; -} - -header -{ - display: block; - padding: 6px 4px; -} - -.class-description { - font-style: italic; - font-family: Palatino, 'Palatino Linotype', serif; - font-size: 130%; - line-height: 140%; - margin-bottom: 1em; - margin-top: 1em; -} - -#main { - float: left; - width: 100%; -} - -section -{ - display: block; - - background-color: #fff; - padding: 12px 24px; - border-bottom: 1px solid #ccc; - margin-right: 240px; -} - -.variation { - display: none; -} - -.optional:after { - content: "opt"; - font-size: 60%; - color: #aaa; - font-style: italic; - font-weight: lighter; -} - -nav -{ - display: block; - float: left; - margin-left: -230px; - margin-top: 28px; - width: 220px; - border-left: 1px solid #ccc; - padding-left: 9px; -} - -nav ul { - font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; - font-size: 100%; - line-height: 17px; - padding:0; - margin:0; - list-style-type:none; -} - -nav h2 a, nav h2 a:visited { - color: #A35A00; - text-decoration: none; -} - -nav h3 { - margin-top: 12px; -} - -nav li { - margin-top: 6px; -} - -nav a { - color: #5C5954; -} - -nav a:visited { - color: #5C5954; -} - -nav a:active { - color: #5C5954; -} - -footer { - display: block; - padding: 6px; - margin-top: 12px; - font-style: italic; - font-size: 90%; -} - -h1 -{ - font-size: 200%; - font-weight: bold; - letter-spacing: -0.01em; - margin: 6px 0 9px 0; -} - -h2 -{ - font-size: 170%; - font-weight: bold; - letter-spacing: -0.01em; - margin: 6px 0 3px 0; -} - -h3 -{ - font-size: 150%; - font-weight: bold; - letter-spacing: -0.01em; - margin-top: 16px; - margin: 6px 0 3px 0; -} - -h4 -{ - font-size: 130%; - font-weight: bold; - letter-spacing: -0.01em; - margin-top: 16px; - margin: 18px 0 3px 0; - color: #A35A00; -} - -h5, .container-overview .subsection-title -{ - font-size: 120%; - font-weight: bold; - letter-spacing: -0.01em; - margin: 8px 0 3px -16px; -} - -h6 -{ - font-size: 100%; - letter-spacing: -0.01em; - margin: 6px 0 3px 0; - font-style: italic; -} - -.ancestors { color: #999; } -.ancestors a -{ - color: #999 !important; - text-decoration: none; -} - -.important -{ - font-weight: bold; - color: #950B02; -} - -.yes-def { - text-indent: -1000px; -} - -.type-signature { - color: #aaa; -} - -.name, .signature { - font-family: Consolas, "Lucida Console", Monaco, monospace; -} - -.details { margin-top: 14px; border-left: 2px solid #DDD; } -.details dt { width:100px; float:left; padding-left: 10px; padding-top: 6px; } -.details dd { margin-left: 50px; } -.details ul { margin: 0; } -.details ul { list-style-type: none; } -.details li { margin-left: 30px; padding-top: 6px; } -.details pre.prettyprint { margin: 0 } -.details .object-value { padding-top: 0; } - -.description { - margin-bottom: 1em; - margin-left: -16px; - margin-top: 1em; -} - -.code-caption -{ - font-style: italic; - font-family: Palatino, 'Palatino Linotype', serif; - font-size: 107%; - margin: 0; -} - -.prettyprint -{ - border: 1px solid #ddd; - width: 80%; - overflow: auto; -} - -.prettyprint.source { - width: inherit; -} - -.prettyprint code -{ - font-family: Consolas, 'Lucida Console', Monaco, monospace; - font-size: 100%; - line-height: 18px; - display: block; - padding: 4px 12px; - margin: 0; - background-color: #fff; - color: #000; - border-left: 3px #ddd solid; -} - -.prettyprint code span.line -{ - display: inline-block; -} - -.params, .props -{ - border-spacing: 0; - border: 0; - border-collapse: collapse; -} - -.params .name, .props .name, .name code { - color: #A35A00; - font-family: Consolas, 'Lucida Console', Monaco, monospace; - font-size: 100%; -} - -.params td, .params th, .props td, .props th -{ - border: 1px solid #ddd; - margin: 0px; - text-align: left; - vertical-align: top; - padding: 4px 6px; - display: table-cell; -} - -.params thead tr, .props thead tr -{ - background-color: #ddd; - font-weight: bold; -} - -.params .params thead tr, .props .props thead tr -{ - background-color: #fff; - font-weight: bold; -} - -.params th, .props th { border-right: 1px solid #aaa; } -.params thead .last, .props thead .last { border-right: 1px solid #ddd; } - -.disabled { - color: #454545; -} diff --git a/doc/styles/prettify-jsdoc.css b/doc/styles/prettify-jsdoc.css deleted file mode 100644 index 5a2526e3..00000000 --- a/doc/styles/prettify-jsdoc.css +++ /dev/null @@ -1,111 +0,0 @@ -/* JSDoc prettify.js theme */ - -/* plain text */ -.pln { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* string content */ -.str { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a keyword */ -.kwd { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a comment */ -.com { - font-weight: normal; - font-style: italic; -} - -/* a type name */ -.typ { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a literal value */ -.lit { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* punctuation */ -.pun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp open bracket */ -.opn { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp close bracket */ -.clo { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a markup tag name */ -.tag { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute name */ -.atn { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute value */ -.atv { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a declaration */ -.dec { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a variable name */ -.var { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a function name */ -.fun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; -}