Skip to content
Play sounds by shelling out to one of the available audio players.
JavaScript
Branch: master
Clone or download
Latest commit 0534507 Dec 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets provide a function for testing Sep 18, 2014
shims fix travis Sep 12, 2014
.gitignore start with this Sep 8, 2014
.travis.yml Update .travis.yml Dec 18, 2018
LICENSE add license Oct 22, 2016
README.md fix readme to document usage of cmdmp3 Oct 22, 2016
index.js fix: whitespace and semicolons Dec 13, 2017
package-lock.json test: update devDeps and fix tests Dec 18, 2018
package.json 1.1.3 Dec 19, 2018
tests.js test: update devDeps and fix tests Dec 18, 2018

README.md

play-sound

Build Status Downloads

Play sounds by shelling out to one of the available audio players.

Installation

npm install play-sound

Examples

var player = require('play-sound')(opts = {})

// $ mplayer foo.mp3 
player.play('foo.mp3', function(err){
  if (err) throw err
})

// { timeout: 300 } will be passed to child process
player.play('foo.mp3', { timeout: 300 }, function(err){
  if (err) throw err
})

// configure arguments for executable if any
player.play('foo.mp3', { afplay: ['-v', 1 ] /* lower volume for afplay on OSX */ }, function(err){
  if (err) throw err
})

// access the node child_process in case you need to kill it on demand
var audio = player.play('foo.mp3', function(err){
  if (err && !err.killed) throw err
})
audio.kill()

Options

Prior art

  • play.js - play sound files from node.js to your speakers

License

MIT

You can’t perform that action at this time.