effects cleanup and comments

This commit is contained in:
Eric Rosenbaum 2016-10-18 13:32:51 -04:00
parent 72733b6e7a
commit c47957f421

View file

@ -8,19 +8,22 @@ function AudioEngine (sounds) {
this.tone = new Tone(); this.tone = new Tone();
// effects setup // effects setup
// each effect has a single parameter controlled by the effects block
this.delay = new Tone.FeedbackDelay(0.25, 0.5); this.delay = new Tone.FeedbackDelay(0.25, 0.5);
this.panner = new Tone.Panner(); this.panner = new Tone.Panner();
this.reverb = new Tone.Freeverb(); this.reverb = new Tone.Freeverb();
this.pitchShiftRatio = 1; this.pitchShiftRatio;
// reset effects to their default parameters
this.clearEffects(); this.clearEffects();
// the effects are chained to an effects node for this clone, then to the master output
// so audio is sent from each sampler or instrument, through the effects in order, then out
// note that the pitch effect works differently - it sets the playback rate for each sampler
this.effectsNode = new Tone.Gain(); this.effectsNode = new Tone.Gain();
this.effectsNode.chain(this.delay, this.panner, this.reverb, Tone.Master); this.effectsNode.chain(this.delay, this.panner, this.reverb, Tone.Master);
// Tone.Master.chain(this.delay, this.panner, this.reverb);
// drum sounds // drum sounds
// var drumFileNames = ['high_conga', 'small_cowbell', // var drumFileNames = ['high_conga', 'small_cowbell',
@ -138,10 +141,6 @@ AudioEngine.prototype.clearEffects = function () {
this.reverb.wet.value = 0; this.reverb.wet.value = 0;
}; };
// AudioEngine.prototype.loadSoundFromUrl = function(url) {
// };
AudioEngine.prototype._clamp = function (input, min, max) { AudioEngine.prototype._clamp = function (input, min, max) {
return Math.min(Math.max(input, min), max); return Math.min(Math.max(input, min), max);
}; };