diff --git a/Tone.js b/Tone.js index 4b631441..09064c78 100644 --- a/Tone.js +++ b/Tone.js @@ -457,6 +457,8 @@ define('Tone/signal/Signal',["Tone/core/Tone"], function(Tone){ //set the default value this.setValue(this.defaultArg(value, 0)); + + this.output.noGC(); }; Tone.extend(Tone.Signal); @@ -609,15 +611,25 @@ define('Tone/signal/Signal',["Tone/core/Tone"], function(Tone){ /** * 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){ - //get the sync ratio - if (signal.getValue() !== 0){ - this._syncRatio = this.getValue() / signal.getValue(); + Tone.Signal.prototype.sync = function(signal, ratio){ + if (ratio){ + this._syncRatio = ratio; } else { - this._syncRatio = 0; + //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(); @@ -646,8 +658,6 @@ define('Tone/signal/Signal',["Tone/core/Tone"], function(Tone){ /** * internal dispose method to tear down the node - * - * @override */ Tone.Signal.prototype.dispose = function(){ //disconnect everything @@ -916,7 +926,7 @@ define('Tone/component/DryWet',["Tone/core/Tone", "Tone/signal/Signal", "Tone/si * * @type {GainNode} */ - this.wetness = new Tone.Signal(0); + this.wetness = new Tone.Signal(initialDry); /** * invert the incoming signal * @private @@ -931,6 +941,9 @@ define('Tone/component/DryWet',["Tone/core/Tone", "Tone/signal/Signal", "Tone/si this.chain(this.wetness, this._invert, this.wet.gain); //dry control this.chain(this.wetness, this.dry.gain); + + this.dry.gain.value = 0; + this.wet.gain.value = 0; }; Tone.extend(Tone.DryWet); @@ -943,7 +956,7 @@ define('Tone/component/DryWet',["Tone/core/Tone", "Tone/signal/Signal", "Tone/si */ Tone.DryWet.prototype.setDry = function(val, rampTime){ rampTime = this.defaultArg(rampTime, 0); - this.wetness.linearRampToValueAtTime(val, this.toSeconds(rampTime)); + this.wetness.linearRampToValueAtTime(this.equalPowerScale(val), this.toSeconds(rampTime)); }; /** @@ -979,7 +992,7 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct /** * Envelope - * ADR envelope generator attaches to an AudioParam + * ADR envelope generator attaches to an AudioParam or AudioNode * * @constructor * @extends {Tone} @@ -994,16 +1007,21 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct //extend Unit Tone.call(this); - //set the parameters + /** @type {number} */ this.attack = this.defaultArg(attack, 0.01); + /** @type {number} */ this.decay = this.defaultArg(decay, 0.1); + /** @type {number} */ this.release = this.defaultArg(release, 1); + /** @type {number} */ this.sustain = this.defaultArg(sustain, 0.5); + /** @type {number} */ this.min = this.defaultArg(minOutput, 0); + /** @type {number} */ this.max = this.defaultArg(maxOutput, 1); - //the control signal + /** @type {Tone.Signal} */ this.control = new Tone.Signal(this.min); //connections @@ -1036,7 +1054,7 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct * attack->decay->sustain exponential ramp * @param {Tone.Time} time */ - Tone.Envelope.prototype.triggerAttackExp = function(time){ + Tone.Envelope.prototype.triggerExponentialAttack = function(time){ var startVal = this.min; if (!time){ startVal = this.control.getValue(); @@ -1073,7 +1091,7 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct * * @param {Tone.Time} time */ - Tone.Envelope.prototype.triggerReleaseExp = function(time){ + Tone.Envelope.prototype.triggerExponentialRelease = function(time){ var startVal = this.control.getValue(); if (time){ startVal = (this.max - this.min) * this.sustain + this.min; @@ -1106,6 +1124,14 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct this._connect(param); }; + /** + * disconnect and dispose + */ + Tone.Envelope.prototype.dispose = function(){ + this.control.dispose(); + this.control = null; + }; + return Tone.Envelope; }); @@ -2194,7 +2220,7 @@ function(Tone){ this.state = Tone.Source.State.STARTED; //get previous values var type = this.oscillator.type; - var detune = this.oscillator.frequency.value; + var detune = this.oscillator.detune.value; //new oscillator with previous values this.oscillator = this.context.createOscillator(); this.oscillator.type = type; @@ -2313,7 +2339,6 @@ define('Tone/component/LFO',["Tone/core/Tone", "Tone/source/Oscillator", "Tone/s * @param {number=} outputMax */ Tone.LFO = function(rate, outputMin, outputMax){ - Tone.call(this); /** @type {Tone.Oscillator} */ @@ -2413,6 +2438,18 @@ define('Tone/component/LFO',["Tone/core/Tone", "Tone/source/Oscillator", "Tone/s this._connect(param); }; + /** + * 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){ @@ -2571,62 +2608,6 @@ define('Tone/component/Meter',["Tone/core/Tone", "Tone/core/Master"], function(T 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; -}); - /////////////////////////////////////////////////////////////////////////////// // // PANNER @@ -2636,47 +2617,23 @@ define('Tone/signal/Merge',["Tone/core/Tone"], function(Tone){ // 1 = 100% Right /////////////////////////////////////////////////////////////////////////////// -define('Tone/component/Panner',["Tone/core/Tone", "Tone/signal/Merge", "Tone/signal/Signal", "Tone/signal/Scale"], +define('Tone/component/Panner',["Tone/core/Tone", "Tone/component/DryWet"], function(Tone){ + /** + * a panner is just a dry/wet knob + */ Tone.Panner = function(){ - Tone.call(this); - - //components - //incoming signal is sent to left and right - this.left = this.context.createGain(); - this.right = this.context.createGain(); - this.control = new Tone.Signal(); - this.merge = new Tone.Merge(); - this.invert = new Tone.Scale(1, 0); - this.normal = new Tone.Scale(0, 1); - - //connections - this.chain(this.input, this.left, this.merge.left); - this.chain(this.input, this.right, this.merge.right); - this.merge.connect(this.output); - //left channel control - this.chain(this.control, this.invert, this.left.gain); - //right channel control - this.chain(this.control, this.normal, this.right.gain); - - - //setup - this.left.gain.value = 0; - this.right.gain.value = 0; - this.setPan(.5); + Tone.DryWet.call(this); + this.setPan(0.5); }; - Tone.extend(Tone.Panner); + Tone.extend(Tone.Panner, Tone.DryWet); - Tone.Panner.prototype.setPan = function(val, rampTime){ - rampTime = this.defaultArg(rampTime, 0); - //put val into -1 to 1 range - this.control.linearRampToValueAtTime(val, rampTime); - }; + Tone.Panner.prototype.setPan = Tone.Panner.prototype.setDry; return Tone.Panner; -});; +}); define('Tone/component/Recorder',["Tone/core/Tone", "Tone/core/Master"], function(Tone){ /** @@ -3524,6 +3481,62 @@ define('Tone/signal/BitCrusher',["Tone/core/Tone"], function(Tone){ return Tone.BitCrusher; }); +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){ /** @@ -3791,7 +3804,7 @@ define('Tone/source/Noise',["Tone/core/Tone", "Tone/source/Source"], function(To /** * internal start method * - * @type {Tone.Time} time + * @param {Tone.Time} time * @private */ Tone.Noise.prototype._start = function(time){ @@ -3806,7 +3819,7 @@ define('Tone/source/Noise',["Tone/core/Tone", "Tone/source/Source"], function(To /** * start the noise at a specific time * - * @type {Tone.Time} time + * @param {Tone.Time} time */ Tone.Noise.prototype.start = function(time){ if (this.state === Tone.Source.State.STOPPED){ @@ -3819,7 +3832,7 @@ define('Tone/source/Noise',["Tone/core/Tone", "Tone/source/Source"], function(To /** * internal stop method * - * @type {Tone.Time} time + * @param {Tone.Time} time * @private */ Tone.Noise.prototype._stop = function(time){ @@ -3830,7 +3843,7 @@ define('Tone/source/Noise',["Tone/core/Tone", "Tone/source/Source"], function(To /** * stop the noise at a specific time * - * @type {Tone.Time} time + * @param {Tone.Time} time */ Tone.Noise.prototype.stop = function(time){ if (this.state === Tone.Source.State.STARTED) { diff --git a/doc/Tone.Add.html b/doc/Tone.Add.html index 3942eb75..cea9efb9 100644 --- a/doc/Tone.Add.html +++ b/doc/Tone.Add.html @@ -130,7 +130,7 @@
Source:
@@ -222,7 +222,7 @@
Source:
@@ -489,7 +489,7 @@
Source:
@@ -552,7 +552,7 @@
Source:
@@ -613,7 +613,7 @@
Source:
@@ -1421,9 +1421,7 @@
- a dispose method - - should be overridden by child classes + dispose method
@@ -1442,10 +1440,74 @@ -
Inherited From:
-
+ + + + + + + + + + + + +
Source:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+

dispose()

+ + +
+
+ + +
+ dispose method +
+ + + + + + + + + +
+ + + + + + @@ -1461,7 +1523,7 @@
Source:
@@ -1873,7 +1935,7 @@
Source:
@@ -2434,7 +2496,7 @@
Source:
@@ -2818,7 +2880,7 @@
Source:
@@ -2906,7 +2968,7 @@
Source:
@@ -3050,7 +3112,7 @@
Source:
@@ -3172,7 +3234,7 @@
Source:
@@ -3312,7 +3374,7 @@
Source:
@@ -3475,7 +3537,7 @@
Source:
@@ -3610,7 +3672,7 @@
Source:
@@ -3732,7 +3794,7 @@
Source:
@@ -3828,7 +3890,7 @@
Source:
@@ -3950,7 +4012,7 @@
Source:
@@ -4095,7 +4157,7 @@
Source:
@@ -4314,7 +4376,7 @@
Source:
@@ -4531,7 +4593,7 @@
Source:
@@ -4749,7 +4811,7 @@
Source:
@@ -4812,13 +4874,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:22 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:55 GMT-0400 (EDT)
diff --git a/doc/Tone.AutoPanner.html b/doc/Tone.AutoPanner.html index dbbc9733..fdda2856 100644 --- a/doc/Tone.AutoPanner.html +++ b/doc/Tone.AutoPanner.html @@ -175,7 +175,7 @@
Source:
@@ -310,7 +310,7 @@
Source:
@@ -430,7 +430,7 @@
Source:
@@ -547,7 +547,7 @@
Source:
@@ -664,7 +664,7 @@
Source:
@@ -781,7 +781,7 @@
Source:
@@ -822,13 +822,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:22 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:55 GMT-0400 (EDT)
diff --git a/doc/Tone.BitCrusher.html b/doc/Tone.BitCrusher.html index 8edf8a06..e6c2c4ae 100644 --- a/doc/Tone.BitCrusher.html +++ b/doc/Tone.BitCrusher.html @@ -176,7 +176,7 @@
Source:
@@ -268,7 +268,7 @@
Source:
@@ -328,7 +328,7 @@
Source:
@@ -388,7 +388,7 @@
Source:
@@ -448,7 +448,7 @@
Source:
@@ -508,7 +508,7 @@
Source:
@@ -568,7 +568,7 @@
Source:
@@ -628,7 +628,7 @@
Source:
@@ -895,7 +895,7 @@
Source:
@@ -958,7 +958,7 @@
Source:
@@ -1019,7 +1019,7 @@
Source:
@@ -1266,7 +1266,7 @@
Source:
@@ -1940,9 +1940,7 @@
- a dispose method - - should be overridden by child classes + clean up
@@ -1961,11 +1959,6 @@ -
Inherited From:
-
- @@ -1980,7 +1973,7 @@
Source:
@@ -2392,7 +2385,7 @@
Source:
@@ -2953,7 +2946,7 @@
Source:
@@ -3337,7 +3330,7 @@
Source:
@@ -3425,7 +3418,7 @@
Source:
@@ -3569,7 +3562,7 @@
Source:
@@ -3691,7 +3684,7 @@
Source:
@@ -3831,7 +3824,7 @@
Source:
@@ -3994,7 +3987,7 @@
Source:
@@ -4129,7 +4122,7 @@
Source:
@@ -4246,7 +4239,7 @@
Source:
@@ -4368,7 +4361,7 @@
Source:
@@ -4464,7 +4457,7 @@
Source:
@@ -4586,7 +4579,7 @@
Source:
@@ -4731,7 +4724,7 @@
Source:
@@ -4950,7 +4943,7 @@
Source:
@@ -5167,7 +5160,7 @@
Source:
@@ -5385,7 +5378,7 @@
Source:
@@ -5448,13 +5441,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:22 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:55 GMT-0400 (EDT)
diff --git a/doc/Tone.DryWet.html b/doc/Tone.DryWet.html index e7bdbc2e..d4f4b7ba 100644 --- a/doc/Tone.DryWet.html +++ b/doc/Tone.DryWet.html @@ -52,8 +52,8 @@ DRY/WET KNOB equal power fading control values: - 0 = 100% dry - 1 = 100% wet + 0 = 100% dry - 0% wet + 1 = 0% dry - 100% wet @@ -134,7 +134,7 @@ equal power fading control values:
Source:
@@ -173,12 +173,343 @@ equal power fading control values: +

Members

+ +
+ +
+

<private> _invert :Tone

+ + +
+
+ +
+ invert the incoming signal +
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

dry :GainNode

+ + +
+
+ +
+ connect this input to the dry signal + the dry signal is also the default input +
+ + + +
Type:
+
    +
  • + +GainNode + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

wet :GainNode

+ + +
+
+ +
+ connect this input to the wet signal +
+ + + +
Type:
+
    +
  • + +GainNode + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

wetness :GainNode

+ + +
+
+ +
+ controls the amount of wet signal + which is mixed into the dry signal +
+ + + +
Type:
+
    +
  • + +GainNode + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ +
+

Methods

+
+

dispose()

+ + +
+
+ + +
+ clean up +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + +

setDry(val, rampTime)

@@ -188,7 +519,7 @@ equal power fading control values:
- Set the dry value of the knob + Set the dry value
@@ -292,7 +623,7 @@ equal power fading control values:
Source:
@@ -328,7 +659,7 @@ equal power fading control values:
- Set the wet value of the knob + Set the wet value
@@ -432,7 +763,7 @@ equal power fading control values:
Source:
@@ -473,13 +804,13 @@ equal power fading control values:
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:23 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:55 GMT-0400 (EDT)
diff --git a/doc/Tone.Envelope.html b/doc/Tone.Envelope.html index 5241f551..3c3e5286 100644 --- a/doc/Tone.Envelope.html +++ b/doc/Tone.Envelope.html @@ -50,7 +50,7 @@
Envelope - ADR envelope generator attaches to an AudioParam + ADR envelope generator attaches to an AudioParam or AudioNode
@@ -308,7 +308,7 @@
Source:
@@ -394,7 +394,67 @@
Source:
+ + + + + + + +
+ + + +
+ + + +
+

attack :number

+ + +
+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -541,6 +601,126 @@ +
+ + + +
+ + + +
+

control :Tone.Signal

+ + +
+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

decay :number

+ + +
+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + +
@@ -661,7 +841,7 @@
Source:
@@ -724,7 +904,7 @@
Source:
@@ -785,7 +965,127 @@
Source:
+ + + + + + + + + + + + + + + +
+

max :number

+ + +
+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

min :number

+ + +
+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -863,6 +1163,126 @@ +
+ + + +
+ + + +
+

release :number

+ + +
+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

sustain :number

+ + +
+
+ + + +
Type:
+ + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + +
@@ -1172,7 +1592,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -1585,9 +2005,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
- a dispose method - - should be overridden by child classes + disconnect and dispose
@@ -1606,11 +2024,6 @@ value will be set to 0 so that it doesn't interfere with the envelope -
Inherited From:
-
- @@ -1625,7 +2038,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -2037,7 +2450,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -2598,7 +3011,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -2982,7 +3395,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -3070,7 +3483,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -3214,7 +3627,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -3336,7 +3749,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -3476,7 +3889,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -3639,7 +4052,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -3779,7 +4192,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -3875,7 +4288,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -3997,7 +4410,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -4142,7 +4555,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -4361,7 +4774,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -4578,7 +4991,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -4796,7 +5209,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -4935,7 +5348,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
@@ -4963,7 +5376,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
-

triggerAttackExp(time)

+

triggerExponentialAttack(time)

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

triggerExponentialRelease(time)

+ + +
+
+ + +
+ triggers the release of the envelope with an exponential ramp +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.Time + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -5169,124 +5699,7 @@ value will be set to 0 so that it doesn't interfere with the envelope
Source:
- - - - - - - -
- - - - - - - - - - - - - -
- - - -
-

triggerReleaseExp(time)

- - -
-
- - -
- triggers the release of the envelope with an exponential ramp -
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
time - - -Tone.Time - - - -
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
@@ -5327,13 +5740,13 @@ value will be set to 0 so that it doesn't interfere with the envelope
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:23 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:56 GMT-0400 (EDT)
diff --git a/doc/Tone.LFO.html b/doc/Tone.LFO.html index 2e3ec26b..ccb570d9 100644 --- a/doc/Tone.LFO.html +++ b/doc/Tone.LFO.html @@ -210,7 +210,7 @@
Source:
@@ -296,7 +296,7 @@
Source:
@@ -563,7 +563,7 @@
Source:
@@ -626,7 +626,7 @@
Source:
@@ -687,7 +687,7 @@
Source:
@@ -747,7 +747,7 @@
Source:
@@ -876,7 +876,7 @@
Source:
@@ -1198,7 +1198,7 @@
Source:
@@ -1611,9 +1611,7 @@
- a dispose method - - should be overridden by child classes + disconnect and dispose
@@ -1632,11 +1630,6 @@ -
Inherited From:
-
- @@ -1651,7 +1644,7 @@
Source:
@@ -2063,7 +2056,7 @@
Source:
@@ -2624,7 +2617,7 @@
Source:
@@ -3008,7 +3001,7 @@
Source:
@@ -3096,7 +3089,7 @@
Source:
@@ -3240,7 +3233,7 @@
Source:
@@ -3362,7 +3355,7 @@
Source:
@@ -3502,7 +3495,7 @@
Source:
@@ -3665,7 +3658,7 @@
Source:
@@ -3800,7 +3793,7 @@
Source:
@@ -3917,7 +3910,7 @@
Source:
@@ -4034,7 +4027,7 @@
Source:
@@ -4151,7 +4144,7 @@
Source:
@@ -4268,7 +4261,7 @@
Source:
@@ -4385,7 +4378,7 @@
Source:
@@ -4455,7 +4448,7 @@
Source:
@@ -4577,7 +4570,7 @@
Source:
@@ -4673,7 +4666,7 @@
Source:
@@ -4795,7 +4788,7 @@
Source:
@@ -4940,7 +4933,7 @@
Source:
@@ -5159,7 +5152,7 @@
Source:
@@ -5376,7 +5369,7 @@
Source:
@@ -5594,7 +5587,7 @@
Source:
@@ -5685,7 +5678,7 @@
Source:
@@ -5726,13 +5719,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:23 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:56 GMT-0400 (EDT)
diff --git a/doc/Tone.Merge.html b/doc/Tone.Merge.html index dc8e1e6e..fd9f06c6 100644 --- a/doc/Tone.Merge.html +++ b/doc/Tone.Merge.html @@ -86,7 +86,7 @@
Source:
@@ -385,7 +385,7 @@
Source:
@@ -448,7 +448,7 @@
Source:
@@ -509,7 +509,7 @@
Source:
@@ -574,7 +574,7 @@
Source:
@@ -638,7 +638,7 @@
Source:
@@ -771,7 +771,7 @@
Source:
@@ -1510,9 +1510,7 @@
- a dispose method - - should be overridden by child classes + clean up
@@ -1531,11 +1529,6 @@ -
Inherited From:
-
- @@ -1550,7 +1543,7 @@
Source:
@@ -1962,7 +1955,7 @@
Source:
@@ -2523,7 +2516,7 @@
Source:
@@ -2907,7 +2900,7 @@
Source:
@@ -2995,7 +2988,7 @@
Source:
@@ -3139,7 +3132,7 @@
Source:
@@ -3261,7 +3254,7 @@
Source:
@@ -3401,7 +3394,7 @@
Source:
@@ -3564,7 +3557,7 @@
Source:
@@ -3704,7 +3697,7 @@
Source:
@@ -3800,7 +3793,7 @@
Source:
@@ -3922,7 +3915,7 @@
Source:
@@ -4067,7 +4060,7 @@
Source:
@@ -4286,7 +4279,7 @@
Source:
@@ -4503,7 +4496,7 @@
Source:
@@ -4721,7 +4714,7 @@
Source:
@@ -4784,13 +4777,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:23 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:56 GMT-0400 (EDT)
diff --git a/doc/Tone.Meter.html b/doc/Tone.Meter.html index 0fdb7f61..a13cc02d 100644 --- a/doc/Tone.Meter.html +++ b/doc/Tone.Meter.html @@ -213,7 +213,7 @@
Source:
@@ -305,7 +305,7 @@
Source:
@@ -369,7 +369,7 @@
Source:
@@ -433,7 +433,7 @@
Source:
@@ -497,7 +497,7 @@
Source:
@@ -626,7 +626,7 @@
Source:
@@ -686,7 +686,7 @@
Source:
@@ -884,7 +884,7 @@
Source:
@@ -947,7 +947,7 @@
Source:
@@ -1008,7 +1008,7 @@
Source:
@@ -1137,7 +1137,7 @@
Source:
@@ -1319,7 +1319,7 @@
Source:
@@ -2022,7 +2022,7 @@
Source:
@@ -2434,7 +2434,7 @@
Source:
@@ -2721,7 +2721,7 @@
Source:
@@ -2868,7 +2868,7 @@
Source:
@@ -3019,7 +3019,7 @@
Source:
@@ -3440,7 +3440,7 @@
Source:
@@ -3824,7 +3824,7 @@
Source:
@@ -3912,7 +3912,7 @@
Source:
@@ -4056,7 +4056,7 @@
Source:
@@ -4178,7 +4178,7 @@
Source:
@@ -4318,7 +4318,7 @@
Source:
@@ -4481,7 +4481,7 @@
Source:
@@ -4621,7 +4621,7 @@
Source:
@@ -4717,7 +4717,7 @@
Source:
@@ -4839,7 +4839,7 @@
Source:
@@ -4984,7 +4984,7 @@
Source:
@@ -5203,7 +5203,7 @@
Source:
@@ -5420,7 +5420,7 @@
Source:
@@ -5638,7 +5638,7 @@
Source:
@@ -5701,13 +5701,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:23 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:56 GMT-0400 (EDT)
diff --git a/doc/Tone.Microphone.html b/doc/Tone.Microphone.html index 0de5d451..abb90a82 100644 --- a/doc/Tone.Microphone.html +++ b/doc/Tone.Microphone.html @@ -145,7 +145,7 @@
Source:
@@ -237,7 +237,7 @@
Source:
@@ -297,7 +297,7 @@
Source:
@@ -426,7 +426,7 @@
Source:
@@ -624,7 +624,7 @@
Source:
@@ -687,7 +687,7 @@
Source:
@@ -748,7 +748,7 @@
Source:
@@ -817,7 +817,7 @@
Source:
@@ -882,7 +882,7 @@
Source:
@@ -1064,7 +1064,7 @@
Source:
@@ -1181,7 +1181,7 @@
Source:
@@ -1855,9 +1855,7 @@
- a dispose method - - should be overridden by child classes + clean up
@@ -1876,11 +1874,6 @@ -
Inherited From:
-
- @@ -1895,7 +1888,7 @@
Source:
@@ -2321,7 +2314,7 @@
Source:
@@ -2448,7 +2441,7 @@
Source:
@@ -3009,7 +3002,7 @@
Source:
@@ -3393,7 +3386,7 @@
Source:
@@ -3481,7 +3474,7 @@
Source:
@@ -3621,7 +3614,7 @@
Source:
@@ -3743,7 +3736,7 @@
Source:
@@ -3865,7 +3858,7 @@
Source:
@@ -4005,7 +3998,7 @@
Source:
@@ -4168,7 +4161,7 @@
Source:
@@ -4304,7 +4297,7 @@
Source:
@@ -4425,7 +4418,7 @@
Source:
@@ -4546,7 +4539,7 @@
Source:
@@ -4620,7 +4613,7 @@
Source:
@@ -4742,7 +4735,7 @@
Source:
@@ -4838,7 +4831,7 @@
Source:
@@ -4960,7 +4953,7 @@
Source:
@@ -5105,7 +5098,7 @@
Source:
@@ -5324,7 +5317,7 @@
Source:
@@ -5541,7 +5534,7 @@
Source:
@@ -5759,7 +5752,7 @@
Source:
@@ -5855,7 +5848,7 @@
Source:
@@ -5896,13 +5889,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:24 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:57 GMT-0400 (EDT)
diff --git a/doc/Tone.Multiply.html b/doc/Tone.Multiply.html index 2e5c34e3..5cfda928 100644 --- a/doc/Tone.Multiply.html +++ b/doc/Tone.Multiply.html @@ -142,7 +142,7 @@
Source:
@@ -377,7 +377,7 @@
Source:
@@ -437,7 +437,7 @@
Source:
@@ -500,7 +500,7 @@
Source:
@@ -561,7 +561,7 @@
Source:
@@ -1369,9 +1369,7 @@
- a dispose method - - should be overridden by child classes + clean up
@@ -1390,11 +1388,6 @@ -
Inherited From:
-
- @@ -1409,7 +1402,7 @@
Source:
@@ -1821,7 +1814,7 @@
Source:
@@ -2382,7 +2375,7 @@
Source:
@@ -2766,7 +2759,7 @@
Source:
@@ -2854,7 +2847,7 @@
Source:
@@ -2998,7 +2991,7 @@
Source:
@@ -3120,7 +3113,7 @@
Source:
@@ -3260,7 +3253,7 @@
Source:
@@ -3423,7 +3416,7 @@
Source:
@@ -3558,7 +3551,7 @@
Source:
@@ -3680,7 +3673,7 @@
Source:
@@ -3776,7 +3769,7 @@
Source:
@@ -3898,7 +3891,7 @@
Source:
@@ -4043,7 +4036,7 @@
Source:
@@ -4262,7 +4255,7 @@
Source:
@@ -4479,7 +4472,7 @@
Source:
@@ -4697,7 +4690,7 @@
Source:
@@ -4760,13 +4753,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:24 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:57 GMT-0400 (EDT)
diff --git a/doc/Tone.Noise.html b/doc/Tone.Noise.html new file mode 100644 index 00000000..afd305ea --- /dev/null +++ b/doc/Tone.Noise.html @@ -0,0 +1,6105 @@ + + + + + JSDoc: Class: Noise + + + + + + + + + + +
+ +

Class: Noise

+ + + + + +
+ +
+

+ Tone. + + Noise +

+ +
+ +
+
+ + + + +
+

new Noise(type)

+ + +
+
+ + +
+ Noise generator. + + uses looped noise buffers to save on performance. +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + the noise type (white|pink|brown)
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + +
+ + +

Extends

+ + + + + + + + + + + + + +

Members

+ +
+ +
+

<private> _buffer :AudioBuffer

+ + +
+
+ +
+ the buffer +
+ + + +
Type:
+
    +
  • + +AudioBuffer + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

<private> _source :AudioBufferSourceNode

+ + +
+
+ + + +
Type:
+
    +
  • + +AudioBufferSourceNode + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

bufferSize :number

+ + +
+
+ +
+ the default buffer size +
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

context :AudioContext

+ + +
+
+ +
+ A static pointer to the audio context +
+ + + +
Type:
+
    +
  • + +AudioContext + + +
  • +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

input :GainNode

+ + +
+
+ +
+ default input of the ToneNode +
+ + + +
Type:
+
    +
  • + +GainNode + + +
  • +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

isFrequency

+ + +
+
+ +
+ true if the input is in the format number+hz + i.e.: 10hz +
+ + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

isNotation

+ + +
+
+ +
+ tests if a string is musical notation + i.e.: + 4n = quarter note + 2m = two measures + 8t = eighth-note triplet +
+ + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

isTransportTime

+ + +
+
+ +
+ tests if a string is transportTime + i.e. : + 1:2:0 = 1 measure + two quarter notes + 0 sixteenth notes +
+ + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

output :GainNode

+ + +
+
+ +
+ unlike most ToneNodes, Sources only have an output and no input +
+ + + +
Type:
+
    +
  • + +GainNode + + +
  • +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

state :Tone.Source.State

+ + +
+
+ + + +
Type:
+ + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ + + +
+

waveShaperResolution :number

+ + +
+
+ +
+ the default resolution for WaveShaperNodes +
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+

<private> _onended()

+ + +
+
+ + +
+ internal call when the buffer is done playing +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

<private> _start(time)

+ + +
+
+ + +
+ internal start method +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.Time + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

<private> _stop(time)

+ + +
+
+ + +
+ internal stop method +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.Time + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

chain()

+ + +
+
+ + +
+ connect together all of the arguments in series +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeArgumentDescription
+ + +AudioParam +| + +Tone + + + + + + + + + + <repeatable>
+ +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

connect(unit)

+ + +
+
+ + +
+ connect the output of a ToneNode to an AudioParam, AudioNode, or ToneNode +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
unit + + +Tone +| + +AudioParam +| + +AudioNode + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

dbToGain(db) → {number}

+ + +
+
+ + +
+ convert db scale to gain scale (0-1) +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
db + + +number + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

defaultArg(given, fallback) → {*}

+ + +
+
+ + +
+ if a the given is undefined, use the fallback +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
given + + +* + + + +
fallback + + +* + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +* + + +
+
+ + + + +
+ + + +
+

disconnect()

+ + +
+
+ + +
+ disconnect the output +
+ + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

dispose()

+ + +
+
+ + +
+ dispose all the components +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

equalPowerScale(percent) → {number}

+ + +
+
+ + +
+ equal power gain scale + good for cross-fading +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
percent + + +number + + + + (0-1)
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + +
+ output gain (0-1) +
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

expScale(gain) → {number}

+ + +
+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
gain + + +number + + + + (0-1)
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + +
+ gain (decibel scale but betwee 0-1) +
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

fadeTo(value, time)

+ + +
+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +number + + + +
time + + +Tone.Time + + + + (relative to 'now')
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

frequencyToSeconds(freq) → {number}

+ + +
+
+ + +
+ convert a frequency into seconds + accepts both numbers and strings + i.e. 10hz or 10 both equal .1 +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
freq + + +number +| + +string + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

gainToDb(gain) → {number}

+ + +
+
+ + +
+ convert gain scale to decibels +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
gain + + +number + + + + (0-1)
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

interpolate(input, outputMin, outputMax) → {number}

+ + +
+
+ + +
+ interpolate the input value (0-1) to be between outputMin and outputMax +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
input + + +number + + + +
outputMin + + +number + + + +
outputMax + + +number + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

logScale(gain) → {number}

+ + +
+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
gain + + +number + + + + (0-1)
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + +
+ gain (decibel scale but betwee 0-1) +
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

noGC()

+ + +
+
+ + +
+ 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 +
+ + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

normalize(input, inputMin, inputMax) → {number}

+ + +
+
+ + +
+ normalize the input to 0-1 from between inputMin to inputMax +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
input + + +number + + + +
inputMin + + +number + + + +
inputMax + + +number + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

notationToSeconds(notation, bpm, timeSignature) → {number}

+ + +
+
+ + +
+ convert notation format strings to seconds +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
notation + + +string + + + + + + + + + +
bpm + + +number + + + + + + <optional>
+ + + + + +
timeSignature + + +number + + + + + + <optional>
+ + + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

now() → {number}

+ + +
+
+ + + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + +
+ the currentTime from the AudioContext +
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

onended()

+ + +
+
+ + +
+ set a callback function to invoke when the sample is over +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

<abstract> pause(time)

+ + +
+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.Time + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

receive(channelName)

+ + +
+
+ + +
+ recieve the input from the desired channelName to the input gain of 'this' node. +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
channelName + + +string + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

samplesToSeconds(samples) → {number}

+ + +
+
+ + +
+ convert a sample count to seconds +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
samples + + +number + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

secondsToFrequency(seconds) → {number}

+ + +
+
+ + +
+ convert a number in seconds to a frequency +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
seconds + + +number + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

send(channelName, amount) → {GainNode}

+ + +
+
+ + +
+ send signal to a channel name +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
channelName + + +string + + + +
amount + + +number + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +GainNode + + +
+
+ + + + +
+ + + +
+

setType(type, time)

+ + +
+
+ + +
+ set the noise type +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + the noise type (white|pink|brown)
time + + +Tone.Time + + + + (optional) time that the set will occur
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

setVolume(value)

+ + +
+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + +number + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

start(time)

+ + +
+
+ + +
+ start the noise at a specific time +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.Time + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

stop(time)

+ + +
+
+ + +
+ stop the noise at a specific time +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.Time + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

sync()

+ + +
+
+ + +
+ sync the source to the Transport +
+ + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

toFrequency(time) → {number}

+ + +
+
+ + +
+ convert a time to a frequency +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.Time + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + +
+ the time in hertz +
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

toMaster()

+ + +
+
+ + +
+ connect 'this' to the master output +
+ + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

toSamples(time) → {number}

+ + +
+
+ + +
+ convert a time into samples +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.time + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

toSeconds(time) → {number}

+ + +
+
+ + +
+ convert Tone.Time to seconds + + this is a simplified version which only handles numbers and + 'now' relative numbers. If the Transport is included this + method is overridden to include many other features including + notationTime, Frequency, and transportTime +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
time + + +Tone.Time + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

toSeconds(time, bpm, timeSignature) → {number}

+ + +
+
+ + +
+ convert Tone.Time into seconds. + + unlike the method which it overrides, this takes into account + transporttime and musical notation +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
time + + +Tone.Time + + + + + + + + + +
bpm + + +number + + + + + + <optional>
+ + + + + +
timeSignature + + +number + + + + + + <optional>
+ + + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

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>
+ + + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +string + + +
+
+ + + + +
+ + + +
+

transportTimeToSeconds(transportTime, bpm, timeSignature) → {number}

+ + +
+
+ + +
+ convert transportTime into seconds + i.e.: + 4:2:3 == 4 measures + 2 quarters + 3 sixteenths +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
transportTime + + +string + + + + + + + + + +
bpm + + +number + + + + + + <optional>
+ + + + + +
timeSignature + + +number + + + + + + <optional>
+ + + + + +
+ + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +
Returns:
+ + +
+ seconds +
+ + + +
+
+ Type +
+
+ +number + + +
+
+ + + + +
+ + + +
+

unsync()

+ + +
+
+ + +
+ unsync the source to the Transport +
+ + + + + + + + + +
+ + + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:57 GMT-0400 (EDT) +
+ + + + + \ No newline at end of file diff --git a/doc/Tone.Oscillator.html b/doc/Tone.Oscillator.html index 767eb8c5..295b3d6e 100644 --- a/doc/Tone.Oscillator.html +++ b/doc/Tone.Oscillator.html @@ -178,7 +178,7 @@
Source:
@@ -412,7 +412,7 @@
Source:
@@ -541,7 +541,7 @@
Source:
@@ -604,7 +604,7 @@
Source:
@@ -665,7 +665,7 @@
Source:
@@ -729,7 +729,7 @@
Source:
@@ -798,7 +798,7 @@
Source:
@@ -863,7 +863,7 @@
Source:
@@ -997,7 +997,7 @@
Source:
@@ -1704,7 +1704,7 @@
Source:
@@ -2130,7 +2130,7 @@
Source:
@@ -2257,7 +2257,7 @@
Source:
@@ -2818,7 +2818,7 @@
Source:
@@ -3202,7 +3202,7 @@
Source:
@@ -3290,7 +3290,7 @@
Source:
@@ -3377,7 +3377,7 @@
Source:
@@ -3495,7 +3495,7 @@
Source:
@@ -3617,7 +3617,7 @@
Source:
@@ -3739,7 +3739,7 @@
Source:
@@ -3879,7 +3879,7 @@
Source:
@@ -4042,7 +4042,7 @@
Source:
@@ -4220,7 +4220,7 @@
Source:
@@ -4337,7 +4337,7 @@
Source:
@@ -4455,7 +4455,7 @@
Source:
@@ -4572,7 +4572,7 @@
Source:
@@ -4701,7 +4701,7 @@
Source:
@@ -4776,7 +4776,7 @@
Source:
@@ -4898,7 +4898,7 @@
Source:
@@ -4994,7 +4994,7 @@
Source:
@@ -5116,7 +5116,7 @@
Source:
@@ -5261,7 +5261,7 @@
Source:
@@ -5480,7 +5480,7 @@
Source:
@@ -5697,7 +5697,7 @@
Source:
@@ -5915,7 +5915,7 @@
Source:
@@ -6006,7 +6006,7 @@
Source:
@@ -6047,13 +6047,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:24 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:57 GMT-0400 (EDT)
diff --git a/doc/Tone.Player.html b/doc/Tone.Player.html index c1fa8b3f..4b5a45f3 100644 --- a/doc/Tone.Player.html +++ b/doc/Tone.Player.html @@ -132,7 +132,7 @@
Source:
@@ -228,7 +228,7 @@
Source:
@@ -292,7 +292,7 @@
Source:
@@ -352,7 +352,7 @@
Source:
@@ -554,7 +554,7 @@
Source:
@@ -683,7 +683,7 @@
Source:
@@ -746,7 +746,7 @@
Source:
@@ -807,7 +807,7 @@
Source:
@@ -876,7 +876,7 @@
Source:
@@ -941,7 +941,7 @@
Source:
@@ -1006,7 +1006,7 @@
Source:
@@ -1070,7 +1070,7 @@
Source:
@@ -1204,7 +1204,7 @@
Source:
@@ -1911,7 +1911,7 @@
Source:
@@ -2337,7 +2337,7 @@
Source:
@@ -2464,7 +2464,7 @@
Source:
@@ -2928,7 +2928,7 @@
Source:
@@ -3329,7 +3329,7 @@
Source:
@@ -3406,7 +3406,7 @@
Source:
@@ -3790,7 +3790,7 @@
Source:
@@ -3878,7 +3878,7 @@
Source:
@@ -3969,7 +3969,7 @@
Source:
@@ -4087,7 +4087,7 @@
Source:
@@ -4209,7 +4209,7 @@
Source:
@@ -4331,7 +4331,7 @@
Source:
@@ -4471,7 +4471,7 @@
Source:
@@ -4634,7 +4634,7 @@
Source:
@@ -4813,7 +4813,7 @@
Source:
@@ -4931,7 +4931,7 @@
Source:
@@ -5126,7 +5126,7 @@
Source:
@@ -5243,7 +5243,7 @@
Source:
@@ -5317,7 +5317,7 @@
Source:
@@ -5439,7 +5439,7 @@
Source:
@@ -5535,7 +5535,7 @@
Source:
@@ -5657,7 +5657,7 @@
Source:
@@ -5802,7 +5802,7 @@
Source:
@@ -6021,7 +6021,7 @@
Source:
@@ -6238,7 +6238,7 @@
Source:
@@ -6456,7 +6456,7 @@
Source:
@@ -6552,7 +6552,7 @@
Source:
@@ -6593,13 +6593,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:24 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:57 GMT-0400 (EDT)
diff --git a/doc/Tone.Recorder.html b/doc/Tone.Recorder.html index f7117fb6..b70c031f 100644 --- a/doc/Tone.Recorder.html +++ b/doc/Tone.Recorder.html @@ -132,7 +132,7 @@
Source:
@@ -224,7 +224,7 @@
Source:
@@ -284,7 +284,7 @@
Source:
@@ -348,7 +348,7 @@
Source:
@@ -481,7 +481,7 @@
Source:
@@ -679,7 +679,7 @@
Source:
@@ -742,7 +742,7 @@
Source:
@@ -803,7 +803,7 @@
Source:
@@ -1054,7 +1054,7 @@
Source:
@@ -1256,7 +1256,7 @@
Source:
@@ -1789,7 +1789,7 @@
-

dispose()

+

<abstract> dispose()

@@ -1797,9 +1797,7 @@
- a dispose method - - should be overridden by child classes + a dispose method
@@ -2249,7 +2247,7 @@
Source:
@@ -2472,7 +2470,7 @@
Source:
@@ -2555,7 +2553,7 @@
Source:
@@ -2828,7 +2826,7 @@
Source:
@@ -3063,7 +3061,7 @@
Source:
@@ -3447,7 +3445,7 @@
Source:
@@ -3535,7 +3533,7 @@
Source:
@@ -3679,7 +3677,7 @@
Source:
@@ -3798,7 +3796,7 @@
Source:
@@ -3920,7 +3918,7 @@
Source:
@@ -4060,7 +4058,7 @@
Source:
@@ -4223,7 +4221,7 @@
Source:
@@ -4363,7 +4361,7 @@
Source:
@@ -4459,7 +4457,7 @@
Source:
@@ -4581,7 +4579,7 @@
Source:
@@ -4726,7 +4724,7 @@
Source:
@@ -4945,7 +4943,7 @@
Source:
@@ -5162,7 +5160,7 @@
Source:
@@ -5380,7 +5378,7 @@
Source:
@@ -5443,13 +5441,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:25 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:58 GMT-0400 (EDT)
diff --git a/doc/Tone.Scale.html b/doc/Tone.Scale.html index f15194b0..c4072639 100644 --- a/doc/Tone.Scale.html +++ b/doc/Tone.Scale.html @@ -242,7 +242,7 @@
Source:
@@ -334,7 +334,7 @@
Source:
@@ -394,7 +394,7 @@
Source:
@@ -454,7 +454,7 @@
Source:
@@ -514,7 +514,7 @@
Source:
@@ -574,7 +574,7 @@
Source:
@@ -634,7 +634,7 @@
Source:
@@ -694,7 +694,7 @@
Source:
@@ -961,7 +961,7 @@
Source:
@@ -1024,7 +1024,7 @@
Source:
@@ -1085,7 +1085,7 @@
Source:
@@ -1288,7 +1288,7 @@
Source:
@@ -1962,9 +1962,7 @@
- a dispose method - - should be overridden by child classes + clean up
@@ -1983,11 +1981,6 @@ -
Inherited From:
-
- @@ -2002,7 +1995,7 @@
Source:
@@ -2414,7 +2407,7 @@
Source:
@@ -2975,7 +2968,7 @@
Source:
@@ -3359,7 +3352,7 @@
Source:
@@ -3447,7 +3440,7 @@
Source:
@@ -3591,7 +3584,7 @@
Source:
@@ -3713,7 +3706,7 @@
Source:
@@ -3853,7 +3846,7 @@
Source:
@@ -4016,7 +4009,7 @@
Source:
@@ -4151,7 +4144,7 @@
Source:
@@ -4268,7 +4261,7 @@
Source:
@@ -4385,7 +4378,7 @@
Source:
@@ -4502,7 +4495,7 @@
Source:
@@ -4624,7 +4617,7 @@
Source:
@@ -4720,7 +4713,7 @@
Source:
@@ -4842,7 +4835,7 @@
Source:
@@ -4987,7 +4980,7 @@
Source:
@@ -5206,7 +5199,7 @@
Source:
@@ -5423,7 +5416,7 @@
Source:
@@ -5641,7 +5634,7 @@
Source:
@@ -5704,13 +5697,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:25 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:58 GMT-0400 (EDT)
diff --git a/doc/Tone.Signal.html b/doc/Tone.Signal.html index 638736d4..abfe3800 100644 --- a/doc/Tone.Signal.html +++ b/doc/Tone.Signal.html @@ -152,7 +152,7 @@
Source:
@@ -248,7 +248,7 @@
Source:
@@ -515,7 +515,7 @@
Source:
@@ -578,7 +578,7 @@
Source:
@@ -639,7 +639,7 @@
Source:
@@ -703,7 +703,7 @@
Source:
@@ -767,7 +767,7 @@
Source:
@@ -1657,7 +1657,7 @@
Source:
@@ -2351,7 +2351,7 @@
Source:
@@ -3281,7 +3281,7 @@
Source:
@@ -3665,7 +3665,7 @@
Source:
@@ -3753,7 +3753,7 @@
Source:
@@ -3897,7 +3897,7 @@
Source:
@@ -4019,7 +4019,7 @@
Source:
@@ -4159,7 +4159,7 @@
Source:
@@ -4322,7 +4322,7 @@
Source:
@@ -5105,7 +5105,7 @@
-

sync(signal)

+

sync(signal, ratio)

@@ -5115,6 +5115,10 @@
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.
@@ -5136,6 +5140,8 @@ Type + Argument + @@ -5161,6 +5167,14 @@ + + + + + + + + @@ -5168,6 +5182,40 @@ + + + + ratio + + + + + +number + + + + + + + + + <optional>
+ + + + + + + + + + + optionally pass in the ratio between + the two signals, otherwise it will be computed + + + @@ -5195,7 +5243,7 @@
Source:
@@ -5317,7 +5365,7 @@
Source:
@@ -5413,7 +5461,7 @@
Source:
@@ -5535,7 +5583,7 @@
Source:
@@ -5680,7 +5728,7 @@
Source:
@@ -5899,7 +5947,7 @@
Source:
@@ -6116,7 +6164,7 @@
Source:
@@ -6334,7 +6382,7 @@
Source:
@@ -6427,7 +6475,7 @@
Source:
@@ -6468,13 +6516,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:25 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:58 GMT-0400 (EDT)
diff --git a/doc/Tone.Source.html b/doc/Tone.Source.html index 6e03458e..83fddbce 100644 --- a/doc/Tone.Source.html +++ b/doc/Tone.Source.html @@ -87,7 +87,7 @@
Source:
@@ -244,35 +244,6 @@ - - - STOP_SCHEDULED - - - - - -string - - - - - - - - - - - stopScheduled - - - - - - - - - STOPPED @@ -354,7 +325,7 @@
Source:
@@ -621,7 +592,7 @@
Source:
@@ -684,7 +655,7 @@
Source:
@@ -745,7 +716,7 @@
Source:
@@ -809,7 +780,7 @@
Source:
@@ -869,7 +840,7 @@
Source:
@@ -1600,7 +1571,7 @@
-

dispose()

+

<abstract> dispose()

@@ -1608,9 +1579,7 @@
- a dispose method - - should be overridden by child classes + a dispose method
@@ -2069,7 +2038,7 @@
Source:
@@ -2196,7 +2165,7 @@
Source:
@@ -2757,7 +2726,7 @@
Source:
@@ -3141,7 +3110,7 @@
Source:
@@ -3229,7 +3198,7 @@
Source:
@@ -3364,7 +3333,7 @@
Source:
@@ -3486,7 +3455,7 @@
Source:
@@ -3608,7 +3577,7 @@
Source:
@@ -3748,7 +3717,7 @@
Source:
@@ -3911,7 +3880,7 @@
Source:
@@ -4042,7 +4011,7 @@
Source:
@@ -4155,7 +4124,7 @@
Source:
@@ -4268,7 +4237,7 @@
Source:
@@ -4337,7 +4306,7 @@
Source:
@@ -4459,7 +4428,7 @@
Source:
@@ -4555,7 +4524,7 @@
Source:
@@ -4677,7 +4646,7 @@
Source:
@@ -4822,7 +4791,7 @@
Source:
@@ -5041,7 +5010,7 @@
Source:
@@ -5258,7 +5227,7 @@
Source:
@@ -5476,7 +5445,7 @@
Source:
@@ -5567,7 +5536,7 @@
Source:
@@ -5608,13 +5577,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:25 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:58 GMT-0400 (EDT)
diff --git a/doc/Tone.Split.html b/doc/Tone.Split.html index c094c43c..4589f338 100644 --- a/doc/Tone.Split.html +++ b/doc/Tone.Split.html @@ -84,7 +84,7 @@
Source:
@@ -383,7 +383,7 @@
Source:
@@ -446,7 +446,7 @@
Source:
@@ -507,7 +507,7 @@
Source:
@@ -640,7 +640,7 @@
Source:
@@ -700,7 +700,7 @@
Source:
@@ -1431,7 +1431,7 @@
-

dispose()

+

<abstract> dispose()

@@ -1439,9 +1439,7 @@
- a dispose method - - should be overridden by child classes + a dispose method
@@ -1891,7 +1889,7 @@
Source:
@@ -2452,7 +2450,7 @@
Source:
@@ -2836,7 +2834,7 @@
Source:
@@ -2924,7 +2922,7 @@
Source:
@@ -3068,7 +3066,7 @@
Source:
@@ -3190,7 +3188,7 @@
Source:
@@ -3330,7 +3328,7 @@
Source:
@@ -3493,7 +3491,7 @@
Source:
@@ -3633,7 +3631,7 @@
Source:
@@ -3729,7 +3727,7 @@
Source:
@@ -3851,7 +3849,7 @@
Source:
@@ -3996,7 +3994,7 @@
Source:
@@ -4215,7 +4213,7 @@
Source:
@@ -4432,7 +4430,7 @@
Source:
@@ -4650,7 +4648,7 @@
Source:
@@ -4713,13 +4711,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:25 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:59 GMT-0400 (EDT)
diff --git a/doc/Tone.Transport.html b/doc/Tone.Transport.html index efb243c4..dcbee5c9 100644 --- a/doc/Tone.Transport.html +++ b/doc/Tone.Transport.html @@ -83,7 +83,7 @@
Source:
@@ -179,7 +179,7 @@
Source:
@@ -446,7 +446,7 @@
Source:
@@ -509,7 +509,7 @@
Source:
@@ -570,7 +570,7 @@
Source:
@@ -630,7 +630,7 @@
Source:
@@ -759,7 +759,7 @@
Source:
@@ -941,7 +941,7 @@
Source:
@@ -1191,7 +1191,7 @@
Source:
@@ -1282,7 +1282,7 @@
Source:
@@ -1399,7 +1399,7 @@
Source:
@@ -1490,7 +1490,7 @@
Source:
@@ -1607,7 +1607,7 @@
Source:
@@ -1698,7 +1698,7 @@
Source:
@@ -2238,7 +2238,7 @@
-

dispose()

+

<abstract> dispose()

@@ -2246,9 +2246,7 @@
- a dispose method - - should be overridden by child classes + a dispose method
@@ -2698,7 +2696,7 @@
Source:
@@ -2925,7 +2923,7 @@
Source:
@@ -3014,7 +3012,7 @@
Source:
@@ -3101,7 +3099,7 @@
Source:
@@ -3526,7 +3524,7 @@
Source:
@@ -3910,7 +3908,7 @@
Source:
@@ -3998,7 +3996,7 @@
Source:
@@ -4137,7 +4135,7 @@
Source:
@@ -4259,7 +4257,7 @@
Source:
@@ -4381,7 +4379,7 @@
Source:
@@ -4521,7 +4519,7 @@
Source:
@@ -4684,7 +4682,7 @@
Source:
@@ -4863,7 +4861,7 @@
Source:
@@ -5026,7 +5024,7 @@
Source:
@@ -5165,7 +5163,7 @@
Source:
@@ -5305,7 +5303,7 @@
Source:
@@ -5422,7 +5420,7 @@
Source:
@@ -5587,7 +5585,7 @@
Source:
@@ -5772,7 +5770,7 @@
Source:
@@ -5954,7 +5952,7 @@
Source:
@@ -6078,7 +6076,7 @@
Source:
@@ -6195,7 +6193,7 @@
Source:
@@ -6312,7 +6310,7 @@
Source:
@@ -6434,7 +6432,7 @@
Source:
@@ -6530,7 +6528,7 @@
Source:
@@ -6652,7 +6650,7 @@
Source:
@@ -6797,7 +6795,7 @@
Source:
@@ -7016,7 +7014,7 @@
Source:
@@ -7151,7 +7149,7 @@
Source:
@@ -7368,7 +7366,7 @@
Source:
@@ -7586,7 +7584,7 @@
Source:
@@ -7725,7 +7723,7 @@
Source:
@@ -7766,13 +7764,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:26 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:59 GMT-0400 (EDT)
diff --git a/doc/Tone.html b/doc/Tone.html index 30c97b4c..c84b56d2 100644 --- a/doc/Tone.html +++ b/doc/Tone.html @@ -149,6 +149,9 @@
Multiply
+
Noise
+
+
Oscillator
@@ -476,7 +479,7 @@
Source:
@@ -534,7 +537,7 @@
Source:
@@ -590,7 +593,7 @@
Source:
@@ -880,7 +883,76 @@
Source:
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + +
+

<static> Panner()

+ + +
+
+ + +
+ a panner is just a dry/wet knob +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -1521,7 +1593,7 @@
-

dispose()

+

<abstract> dispose()

@@ -1529,9 +1601,7 @@
- a dispose method - - should be overridden by child classes + a dispose method
@@ -1961,7 +2031,7 @@
Source:
@@ -2502,7 +2572,7 @@
Source:
@@ -2876,7 +2946,7 @@
Source:
@@ -2959,7 +3029,7 @@
Source:
@@ -3098,7 +3168,7 @@
Source:
@@ -3215,7 +3285,7 @@
Source:
@@ -3350,7 +3420,7 @@
Source:
@@ -3508,7 +3578,7 @@
Source:
@@ -3643,7 +3713,7 @@
Source:
@@ -3734,7 +3804,7 @@
Source:
@@ -3851,7 +3921,7 @@
Source:
@@ -3991,7 +4061,7 @@
Source:
@@ -4205,7 +4275,7 @@
Source:
@@ -4417,7 +4487,7 @@
Source:
@@ -4630,7 +4700,7 @@
Source:
@@ -4693,13 +4763,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:21 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:54 GMT-0400 (EDT)
diff --git a/doc/Tone.js.html b/doc/Tone.js.html index a487d994..e5f43724 100644 --- a/doc/Tone.js.html +++ b/doc/Tone.js.html @@ -296,11 +296,9 @@ define("Tone/core/Tone", [], function(){ /** * a dispose method * - * should be overridden by child classes + * @abstract */ - Tone.prototype.dispose = function(){ - this.output.disconnect(); - }; + Tone.prototype.dispose = function(){}; /////////////////////////////////////////////////////////////////////////// @@ -486,6 +484,8 @@ define('Tone/signal/Signal',["Tone/core/Tone"], function(Tone){ //set the default value this.setValue(this.defaultArg(value, 0)); + + this.output.noGC(); }; Tone.extend(Tone.Signal); @@ -638,15 +638,25 @@ define('Tone/signal/Signal',["Tone/core/Tone"], function(Tone){ /** * 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){ - //get the sync ratio - if (signal.getValue() !== 0){ - this._syncRatio = this.getValue() / signal.getValue(); + Tone.Signal.prototype.sync = function(signal, ratio){ + if (ratio){ + this._syncRatio = ratio; } else { - this._syncRatio = 0; + //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(); @@ -675,8 +685,6 @@ define('Tone/signal/Signal',["Tone/core/Tone"], function(Tone){ /** * internal dispose method to tear down the node - * - * @override */ Tone.Signal.prototype.dispose = function(){ //disconnect everything @@ -721,6 +729,18 @@ define('Tone/signal/Add',["Tone/core/Tone", "Tone/signal/Signal"], function(Tone 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){ @@ -758,6 +778,14 @@ define('Tone/signal/Multiply',["Tone/core/Tone", "Tone/signal/Signal"], function this.input.gain.value = value; }; + /** + * clean up + */ + Tone.Multiply.prototype.dispose = function(){ + this.input.disconnect(); + this.input = null; + }; + return Tone.Multiply; }); @@ -870,6 +898,23 @@ define('Tone/signal/Scale',["Tone/core/Tone", "Tone/signal/Add", "Tone/signal/Mu 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; }); @@ -879,8 +924,8 @@ define('Tone/component/DryWet',["Tone/core/Tone", "Tone/signal/Signal", "Tone/si * DRY/WET KNOB * * equal power fading control values: - * 0 = 100% dry - * 1 = 100% wet + * 0 = 100% dry - 0% wet + * 1 = 0% dry - 100% wet * * @constructor * @param {number} initialDry @@ -888,43 +933,61 @@ define('Tone/component/DryWet',["Tone/core/Tone", "Tone/signal/Signal", "Tone/si Tone.DryWet = function(initialDry){ Tone.call(this); - //components - this.dry = this.context.createGain(); + /** + * 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(); - //control signal - this.control = new Tone.Signal(); - this.invert = new Tone.Scale(1, 0); - this.normal = new Tone.Scale(0, 1); + /** + * controls the amount of wet signal + * which is mixed into the dry signal + * + * @type {GainNode} + */ + this.wetness = new Tone.Signal(initialDry); + /** + * 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.control, this.invert, this.wet.gain); + this.chain(this.wetness, this._invert, this.wet.gain); //dry control - this.chain(this.control, this.normal, this.dry.gain); + this.chain(this.wetness, this.dry.gain); - //setup this.dry.gain.value = 0; this.wet.gain.value = 0; - this.setDry(0); }; Tone.extend(Tone.DryWet); /** - * Set the dry value of the knob + * Set the dry value * * @param {number} val * @param {Tone.Time} rampTime */ Tone.DryWet.prototype.setDry = function(val, rampTime){ rampTime = this.defaultArg(rampTime, 0); - this.control.linearRampToValueAtTime(val*2 - 1, this.toSeconds(rampTime)); + this.wetness.linearRampToValueAtTime(this.equalPowerScale(val), this.toSeconds(rampTime)); }; /** - * Set the wet value of the knob + * Set the wet value * * @param {number} val * @param {Tone.Time} rampTime @@ -933,6 +996,22 @@ define('Tone/component/DryWet',["Tone/core/Tone", "Tone/signal/Signal", "Tone/si this.setDry(1-val, rampTime); }; + /** + * 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; }); @@ -940,7 +1019,7 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct /** * Envelope - * ADR envelope generator attaches to an AudioParam + * ADR envelope generator attaches to an AudioParam or AudioNode * * @constructor * @extends {Tone} @@ -955,16 +1034,21 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct //extend Unit Tone.call(this); - //set the parameters + /** @type {number} */ this.attack = this.defaultArg(attack, 0.01); + /** @type {number} */ this.decay = this.defaultArg(decay, 0.1); + /** @type {number} */ this.release = this.defaultArg(release, 1); + /** @type {number} */ this.sustain = this.defaultArg(sustain, 0.5); + /** @type {number} */ this.min = this.defaultArg(minOutput, 0); + /** @type {number} */ this.max = this.defaultArg(maxOutput, 1); - //the control signal + /** @type {Tone.Signal} */ this.control = new Tone.Signal(this.min); //connections @@ -997,7 +1081,7 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct * attack->decay->sustain exponential ramp * @param {Tone.Time} time */ - Tone.Envelope.prototype.triggerAttackExp = function(time){ + Tone.Envelope.prototype.triggerExponentialAttack = function(time){ var startVal = this.min; if (!time){ startVal = this.control.getValue(); @@ -1034,7 +1118,7 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct * * @param {Tone.Time} time */ - Tone.Envelope.prototype.triggerReleaseExp = function(time){ + Tone.Envelope.prototype.triggerExponentialRelease = function(time){ var startVal = this.control.getValue(); if (time){ startVal = (this.max - this.min) * this.sustain + this.min; @@ -1067,6 +1151,14 @@ define('Tone/component/Envelope',["Tone/core/Tone", "Tone/signal/Signal"], funct this._connect(param); }; + /** + * disconnect and dispose + */ + Tone.Envelope.prototype.dispose = function(){ + this.control.dispose(); + this.control = null; + }; + return Tone.Envelope; }); @@ -2099,7 +2191,6 @@ define('Tone/source/Source',["Tone/core/Tone", "Tone/core/Transport"], function( Tone.Source.State = { STARTED : "started", PAUSED : "paused", - STOP_SCHEDULED : "stopScheduled", STOPPED : "stopped", SYNCED : "synced" }; @@ -2156,7 +2247,7 @@ function(Tone){ this.state = Tone.Source.State.STARTED; //get previous values var type = this.oscillator.type; - var detune = this.oscillator.frequency.value; + var detune = this.oscillator.detune.value; //new oscillator with previous values this.oscillator = this.context.createOscillator(); this.oscillator.type = type; @@ -2247,13 +2338,14 @@ function(Tone){ * dispose and disconnect */ Tone.Oscillator.prototype.dispose = function(){ - this.output.disconnect(); - if (this.state === Tone.Source.State.STARTED){ - this.stop(); + 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; @@ -2274,7 +2366,6 @@ define('Tone/component/LFO',["Tone/core/Tone", "Tone/source/Oscillator", "Tone/s * @param {number=} outputMax */ Tone.LFO = function(rate, outputMin, outputMax){ - Tone.call(this); /** @type {Tone.Oscillator} */ @@ -2374,6 +2465,18 @@ define('Tone/component/LFO',["Tone/core/Tone", "Tone/source/Oscillator", "Tone/s this._connect(param); }; + /** + * 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){ @@ -2532,50 +2635,6 @@ define('Tone/component/Meter',["Tone/core/Tone", "Tone/core/Master"], function(T 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); - - return Tone.Merge; -}); - /////////////////////////////////////////////////////////////////////////////// // // PANNER @@ -2585,47 +2644,23 @@ define('Tone/signal/Merge',["Tone/core/Tone"], function(Tone){ // 1 = 100% Right /////////////////////////////////////////////////////////////////////////////// -define('Tone/component/Panner',["Tone/core/Tone", "Tone/signal/Merge", "Tone/signal/Signal", "Tone/signal/Scale"], +define('Tone/component/Panner',["Tone/core/Tone", "Tone/component/DryWet"], function(Tone){ + /** + * a panner is just a dry/wet knob + */ Tone.Panner = function(){ - Tone.call(this); - - //components - //incoming signal is sent to left and right - this.left = this.context.createGain(); - this.right = this.context.createGain(); - this.control = new Tone.Signal(); - this.merge = new Tone.Merge(); - this.invert = new Tone.Scale(1, 0); - this.normal = new Tone.Scale(0, 1); - - //connections - this.chain(this.input, this.left, this.merge.left); - this.chain(this.input, this.right, this.merge.right); - this.merge.connect(this.output); - //left channel control - this.chain(this.control, this.invert, this.left.gain); - //right channel control - this.chain(this.control, this.normal, this.right.gain); - - - //setup - this.left.gain.value = 0; - this.right.gain.value = 0; - this.setPan(.5); + Tone.DryWet.call(this); + this.setPan(0.5); }; - Tone.extend(Tone.Panner); + Tone.extend(Tone.Panner, Tone.DryWet); - Tone.Panner.prototype.setPan = function(val, rampTime){ - rampTime = this.defaultArg(rampTime, 0); - //put val into -1 to 1 range - this.control.linearRampToValueAtTime(val, rampTime); - }; + Tone.Panner.prototype.setPan = Tone.Panner.prototype.setDry; return Tone.Panner; -});; +}); define('Tone/component/Recorder',["Tone/core/Tone", "Tone/core/Master"], function(Tone){ /** @@ -3205,7 +3240,6 @@ define('Tone/source/Player',["Tone/core/Tone", "Tone/source/Source"], function(T if (this._buffer){ this.state = Tone.Source.State.STARTED; //default args - startTime = this.defaultArg(startTime, this.now()); offset = this.defaultArg(offset, 0); duration = this.defaultArg(duration, this._buffer.duration - offset); //make the source @@ -3292,13 +3326,13 @@ define('Tone/source/Player',["Tone/core/Tone", "Tone/source/Source"], function(T * dispose and disconnect */ Tone.Player.prototype.dispose = function(){ - this.output.disconnect(); - if (this.state === Tone.Source.State.STARTED){ - this.stop(); + if (this._source !== null){ this._source.disconnect(); this._source = null; } this._buffer = null; + this.output.disconnect(); + this.output = null; }; return Tone.Player; @@ -3460,8 +3494,76 @@ define('Tone/signal/BitCrusher',["Tone/core/Tone"], function(Tone){ 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; }); +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){ /** @@ -3497,6 +3599,18 @@ define('Tone/signal/Split',["Tone/core/Tone"], function(Tone){ Tone.extend(Tone.Split); + /** + * 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.Split; }); /////////////////////////////////////////////////////////////////////////////// @@ -3620,100 +3734,254 @@ define('Tone/source/Microphone',["Tone/core/Tone", "Tone/source/Source"], functi 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; }); -/////////////////////////////////////////////////////////////////////////////// -// -// NOISE -// -/////////////////////////////////////////////////////////////////////////////// -define('Tone/source/Noise',["Tone/core/Tone"], function(Tone){ +define('Tone/source/Noise',["Tone/core/Tone", "Tone/source/Source"], function(Tone){ - //@param {string} type the noise type - Tone.Noise = function(type){ - //extend Unit - Tone.call(this); + var sampleRate = Tone.context.sampleRate; + //two seconds per buffer + var bufferLength = sampleRate * 4; - //components - this.jsNode = this.context.createScriptProcessor(this.bufferSize, 0, 1); + /** + * 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){ - //connections - this.jsNode.connect(this.output); + Tone.Source.call(this); - this.setType(this.defaultArg(type, "white")); - } + /** + * @private + * @type {AudioBufferSourceNode} + */ + this._source = null; + + /** + * the buffer + * @private + * @type {AudioBuffer} + */ + this._buffer = null; - Tone.extend(Tone.Noise, Tone); + /** + * set a callback function to invoke when the sample is over + * + * @type {function} + */ + this.onended = function(){}; - //@param {string} type ('white', 'pink', 'brown') - Tone.Noise.prototype.setType = function(type){ - switch (type){ - case "white" : - this.jsNode.onaudioprocess = this._whiteNoise.bind(this); - break; - case "pink" : - this.jsNode.onaudioprocess = this._pinkNoise.bind(this); - break; - case "brown" : - this.jsNode.onaudioprocess = this._brownNoise.bind(this); - break; - default : - this.jsNode.onaudioprocess = this._whiteNoise.bind(this); - } - } + this.setType(this.defaultArg(type, "white")); + }; - //modified from http://noisehack.com/generate-noise-web-audio-api/ - Tone.Noise.prototype._pinkNoise = (function() { - var b0, b1, b2, b3, b4, b5, b6; - b0 = b1 = b2 = b3 = b4 = b5 = b6 = 0.0; - return function(e) { - var bufferSize = this.jsNode.bufferSize; - var output = e.outputBuffer.getChannelData(0); - for (var i = 0; i < bufferSize; 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; - output[i] = b0 + b1 + b2 + b3 + b4 + b5 + b6 + white * 0.5362; - output[i] *= 0.11; // (roughly) compensate for gain - b6 = white * 0.115926; - } - } - })(); + Tone.extend(Tone.Noise, Tone.Source); - //modified from http://noisehack.com/generate-noise-web-audio-api/ - Tone.Noise.prototype._brownNoise = (function() { - var lastOut = 0.0; - return function(e) { - var bufferSize = this.jsNode.bufferSize; - var output = e.outputBuffer.getChannelData(0); - for (var i = 0; i < bufferSize; i++) { - var white = Math.random() * 2 - 1; - output[i] = (lastOut + (0.02 * white)) / 1.02; - lastOut = output[i]; - output[i] *= 3.5; // (roughly) compensate for gain - } - } - return node; - })(); + /** + * 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); + } + }; - //modified from http://noisehack.com/generate-noise-web-audio-api/ - Tone.Noise.prototype._whiteNoise = function(e){ - var bufferSize = this.jsNode.bufferSize; - var output = e.outputBuffer.getChannelData(0); - for (var i = 0; i < bufferSize; i++) { - output[i] = Math.random() * 2 - 1; - } - } + /** + * 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); + }; - return Tone.Noise; + /** + * 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; }); @@ -3724,13 +3992,13 @@ define('Tone/source/Noise',["Tone/core/Tone"], function(Tone){
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:21 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:54 GMT-0400 (EDT)
diff --git a/doc/global.html b/doc/global.html index 29069ae3..92fbcc0c 100644 --- a/doc/global.html +++ b/doc/global.html @@ -135,7 +135,7 @@
Source:
@@ -185,7 +185,7 @@
Source:
@@ -218,13 +218,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:21 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:54 GMT-0400 (EDT)
diff --git a/doc/index.html b/doc/index.html index 56d1923e..bc3d1246 100644 --- a/doc/index.html +++ b/doc/index.html @@ -48,13 +48,13 @@
- Documentation generated by JSDoc 3.2.2 on Thu Jun 19 2014 13:40:21 GMT-0400 (EDT) + Documentation generated by JSDoc 3.2.2 on Fri Jun 20 2014 01:43:54 GMT-0400 (EDT)