4

Sometimes I turn up the audio on my MacBook, but then forget to turn it back down. Is there a terminal command I could use to detect if audio is currently playing (sound coming from the speakers)?

I need something similar to How to detect that the sound is currently playing in Linux? or Testing if audio devices / sound cards are currently playing?, except that neither of those work as they are for Linux.

2

I actually happened to find the answer recently, and I'll post it here for anyone who might need it:

if [[ "$(pmset -g | grep ' sleep')" == *"coreaudiod"* ]]; then echo audio is playing; else echo no audio playing

I discovered the pmset method from this post, but I added some things to it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .