Simple music / playlist playback

Hi - pretty new to node-red and I could use some advice on how to handle a particular feature implementation for my project. I would like to have a playlist of music (stored as mp3s or wavs in a single directory) be controllable by node-red. The music would be stored on and played back from the server running node-red. Ideally it would have the ability to play, pause, control the volume level, and go to the next or previous track. I had a few initial thoughts on how to implement this but would appreciate any direction or advice:

a) write my own player in javascript using the web audio api or a third party js library and add it as a custom node
b) use exec commands to control a command line or python based player
c) find a media player that can be controlled with osc commands

Any and all advice appreciated! Thanks!

Take a look at this, it might give you some ideas

Thank you Paul! Nice project, I appreciate the clear documentation. I should have mentioned that I'm developing these flows on a mac but intend to deploy on a windows machine. Seems like you are using aplay/amixer here, is that correct? My understanding is those are linux specific.

I have an inkling it may make more sense to go the javascript route. I'd load another webpage on the server machine and allow the ui to pass data to it. The web page would be similar to this web-audio example.

Do you have any suggestions about how to make a javascript based player work within node-red's architecture? I'm a bit confused about where you would execute vanilla JS and how the dashboard would best interact with a webpage running on the same machine as the server.

Thanks again for the help!

If I remember correctly, it actually uses mplayer to play the sound and aplay to control the volume.

Since mplayer runs on windows you might give it a shot.

Remember that the sound will be played on the device running node-red so if you had a Mac running NR but used a windows machine to open the dashboard, the sound would play on the mac.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.