mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-16 13:53:56 +00:00
33 lines
No EOL
679 B
JavaScript
33 lines
No EOL
679 B
JavaScript
define(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Scale"], function(Tone){
|
|
|
|
/**
|
|
* Follow the envelope of the incoming signal
|
|
* @constructor
|
|
* @extends {Tone}
|
|
*/
|
|
Tone.Follower = function(attackTime, releaseTime){
|
|
|
|
/**
|
|
* scale the incoming signal to 0-1
|
|
* @type {Tone.Signal}
|
|
* @private
|
|
*/
|
|
this._scaler = new Tone.Scale(0, 1);
|
|
|
|
/**
|
|
* the lowpass filter
|
|
* @type {BiquadFilterNode}
|
|
* @private
|
|
*/
|
|
this._filter = this.context.createBiquadFilter();
|
|
this._filter.type = "lowpass";
|
|
|
|
/**
|
|
* @type {WaveShaperNode}
|
|
* @private
|
|
*/
|
|
this._gate = this.context.createWaveShaper();
|
|
};
|
|
|
|
Tone.extend(Tone.Follower);
|
|
}); |