From c47957f4211c9ddc48765cd711ce987a026ee3d2 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Tue, 18 Oct 2016 13:32:51 -0400 Subject: [PATCH] effects cleanup and comments --- src/index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 4d821ad..fd216e4 100644 --- a/src/index.js +++ b/src/index.js @@ -8,19 +8,22 @@ function AudioEngine (sounds) { this.tone = new Tone(); // effects setup + // each effect has a single parameter controlled by the effects block this.delay = new Tone.FeedbackDelay(0.25, 0.5); this.panner = new Tone.Panner(); this.reverb = new Tone.Freeverb(); - this.pitchShiftRatio = 1; + this.pitchShiftRatio; + // reset effects to their default parameters 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.chain(this.delay, this.panner, this.reverb, Tone.Master); - // Tone.Master.chain(this.delay, this.panner, this.reverb); - // drum sounds // var drumFileNames = ['high_conga', 'small_cowbell', @@ -138,10 +141,6 @@ AudioEngine.prototype.clearEffects = function () { this.reverb.wet.value = 0; }; -// AudioEngine.prototype.loadSoundFromUrl = function(url) { - -// }; - AudioEngine.prototype._clamp = function (input, min, max) { return Math.min(Math.max(input, min), max); };