diff --git a/src/index.js b/src/index.js index 2f8d4fc..d56b831 100644 --- a/src/index.js +++ b/src/index.js @@ -128,10 +128,14 @@ AudioPlayer.prototype.waitForBeats = function (beats) { return new Promise(function (resolve) { setTimeout(function () { resolve(); - }, ((60 / storedContext.audioEngine.currentTempo) * 1000 * beats)); + }, storedContext.beatsToSec(beats) * 1000); }); }; +AudioPlayer.prototype.beatsToSec = function (beats) { + return (60 / this.audioEngine.currentTempo) * beats; +}; + AudioPlayer.prototype.stopAllSounds = function () { // stop drum notes // for (var i = 0; i