From 73dc7a3d409182daf75c9c26112ef0cd36eba94b Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Mon, 24 Oct 2016 13:57:47 -0400 Subject: [PATCH] change Tone samplers to players --- src/index.js | 56 ++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/index.js b/src/index.js index 3a359e4..7219a68 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,4 @@ +var log = require('./log'); var Tone = require('tone'); var Soundfont = require('soundfont-player'); @@ -15,23 +16,18 @@ function AudioEngine (sounds) { this.reverb = new Tone.Freeverb(); 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 + // so audio is sent from each player or instrument, through the effects in order, then out + // note that the pitch effect works differently - it sets the playback rate for each player this.effectsNode = new Tone.Gain(); this.effectsNode.chain(this.delay, this.panner, this.reverb, Tone.Master); - // drum sounds + // reset effects to their default parameters + // this.clearEffects(); - // var drumFileNames = ['high_conga', 'small_cowbell', - // 'snare_drum', 'splash cymbal']; - // this.drumSamplers = this._loadSoundFiles(drumFileNames); + // load sounds - // sound urls - map each url to its tone.sampler - this.soundSamplers = []; + this.soundPlayers = []; this.loadSounds(sounds); // soundfont setup @@ -58,26 +54,31 @@ function AudioEngine (sounds) { AudioEngine.prototype.loadSounds = function (sounds) { for (var i=0; i