Play audio with Node.JS Play audio with Node.JS node.js node.js

Play audio with Node.JS


I would suggest using node-speaker, which outputs raw PCM data to your speakers (so basically, it plays audio).

If you're playing something like mp3 files you might need to decode it first to PCM data, which is exactly what node-lame does.

Hope that helps.


Simplest I've found (on Mac OS) is to use

exec('afplay whatever.mp3', audioEndCallback)


I think what you asking is there any good modules that work with audio in the nodejs ecosystem?

Whenever you have this type of question you should first go the npmjs and just type a appropiate keyword.

Here is list of modules that related to audio I found on the npmjs site.

substacks's baudio looks good to me.