Skip to content

Instantly share code, notes, and snippets.

@jonbri
Created April 26, 2017 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonbri/30a6ed86c52185d969b688dfa2e5881e to your computer and use it in GitHub Desktop.
Save jonbri/30a6ed86c52185d969b688dfa2e5881e to your computer and use it in GitHub Desktop.
NodeJS: play audio file
var player = require('play-sound')(opts = {});
var sFile = 'hello.wav';
// access the node child_process in case you need to kill it on demand
var audio = player.play(sFile, function(err) {
if (err && !err.killed) throw err
});
setTimeout(function() {
audio.kill()
}, 3000);
@jonbri
Copy link
Author

jonbri commented Apr 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment