Dead simple sound player for Node -- because it should be simple.
const sound = require('sound-play')
sound.play('file.mp3')
-
Support
.wav
,.mp3
and other extensions. -
Work on
Windows
andMacOS
npm install sound-play
yarn add sound-play
sound.play('file.mp3')
or
const path = require('path')
const filePath = path.join(__dirname, 'file.mp3')
sound.play(filePath)
sound.play('C:\\file.mp3')
sound.play('C:\\file.mp3').then(response => console.log('done'))
try {
await sound.play('C:\\file.mp3')
console.log('done')
} catch (error) {
console.error(error)
}
MIT