Get a led diod to glow when playing music

Hi!
So I have a small project that I want to do, but I don’t really know where to start. I use musicbox to play music, and I want to connect a diod to my raspberry pi that lights up when musicbox is playing. Basically, I need to know how to access the information regarding if musicbox is playing music or not. are there any built in functions/comands in modipy/musicbox for this, that for example return TRUE for when musicbox is playing music?

cheers
Carolina

You can use mpc. Something like:
if mpc status | grep -q playing; then echo "turn on LED!"; fi

Note, that will not work when you are streaming music via airplay. If you
wanted to handle that case too, then you could use shairport-sync’s
–on-start and --on-stop options to create/remove a file to indicate it’s
playing. Or something less hacky!