From 72733b6e7aaa4fd0dd230d6033919f0d9d9d6059 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Mon, 17 Oct 2016 16:51:12 -0400 Subject: [PATCH] each clone has its own effects chain --- src/index.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 8cc6383..4d821ad 100644 --- a/src/index.js +++ b/src/index.js @@ -12,10 +12,14 @@ function AudioEngine (sounds) { this.delay = new Tone.FeedbackDelay(0.25, 0.5); this.panner = new Tone.Panner(); this.reverb = new Tone.Freeverb(); + this.pitchShiftRatio = 1; this.clearEffects(); - Tone.Master.chain(this.delay, this.panner, this.reverb); + 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 @@ -38,7 +42,7 @@ function AudioEngine (sounds) { Soundfont.instrument(Tone.context, this.instrumentNames[0]).then( function (inst) { this.instrument = inst; - this.instrument.connect(Tone.Master); + this.instrument.connect(this.effectsNode); }.bind(this) ); } @@ -46,7 +50,8 @@ function AudioEngine (sounds) { AudioEngine.prototype.loadSounds = function (sounds) { for (var i=0; i