var context = new AudioContext();
var synth = new JSSynth.Synthesizer();
synth.init(context.sampleRate);
var node = synth.createAudioNode(context, 8192);
node.connect(context.destination);
synth.loadSFont(sfontBuffer).then(function () {
return synth.addSMFDataToPlayer(smfBuffer);
}).then(function () {
return synth.playPlayer();
}).then(function () {
return synth.waitForPlayerStopped();
}).then(function () {
return synth.waitForVoicesStopped();
}).then(function () {
synth.close();
}, function (err) {
console.log('Failed:', err);
synth.close();
});