I wrote a Node.js package (https://github.com/jbrooksuk/SoundRain) to do this same thing, but I used it within a custom CLI app.