diff --git a/src/InstrumentPlayer.js b/src/InstrumentPlayer.js index cee8cb3..ec0896c 100644 --- a/src/InstrumentPlayer.js +++ b/src/InstrumentPlayer.js @@ -15,11 +15,11 @@ function InstrumentPlayer (outputNode) { this.instruments = []; } -InstrumentPlayer.prototype.playNoteForBeatsWithInstrument = function (note, beats, instrumentNum) { +InstrumentPlayer.prototype.playNoteForSecsWithInst = function (note, sec, instrumentNum) { this.loadInstrument(instrumentNum) .then(() => { this.instruments[instrumentNum].play( - note, Tone.context.currentTime, {duration : Number(beats)} // todo: need to use tempo here + note, Tone.context.currentTime, {duration : sec} ); }); }; diff --git a/src/index.js b/src/index.js index d56b831..6e43cd8 100644 --- a/src/index.js +++ b/src/index.js @@ -114,7 +114,8 @@ AudioPlayer.prototype.playSound = function (index) { }; AudioPlayer.prototype.playNoteForBeats = function (note, beats) { - this.audioEngine.instrumentPlayer.playNoteForBeatsWithInstrument(note, beats, this.currentInstrument); + var sec = this.beatsToSec(beats); + this.audioEngine.instrumentPlayer.playNoteForSecsWithInst(note, sec, this.currentInstrument); return this.waitForBeats(beats); };