diff --git a/src/index.js b/src/index.js index 13b3106..2c1c1b5 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ var Tone = require('tone'); var Soundfont = require('soundfont-player'); -function AudioEngine () { +function AudioEngine (sounds) { // tone setup @@ -25,8 +25,9 @@ function AudioEngine () { // sound urls - map each url to its tone.sampler this.soundSamplers = []; + this.loadSounds(sounds); - // soundfont setup + // soundfont setup // instrument names used by Musyng Kite soundfont, in order to // match scratch instruments @@ -42,6 +43,15 @@ function AudioEngine () { ); } +AudioEngine.prototype.loadSounds = function (sounds) { + for (var i=0; i