function beep() {
var context = new AudioContext();
var oscillator = context.createOscillator();
oscillator.type = "sine";
oscillator.frequency.value = 800;
oscillator.connect(context.destination);
oscillator.start();
// Beep for 500 milliseconds
setTimeout(function () {
oscillator.stop();
}, 500);
}
beep();
// See source for a parametrized sound
var audio = new Audio('assets/audio.mp3');
> Play
audio.play();
> Stop
sound.pause();
> Back to start
sound.currentTime = 0;
const sound = require("sound-play");
sound.play("file.mp3");