Petter
Petter

Reputation: 49

Applescript: Check if computer is playing any sound

Trying to find a way for my script to check if there's any sound/audio being played currently on the computer. And if so, is there any way to find which app is playing sound?

Upvotes: 2

Views: 1710

Answers (1)

user3577225
user3577225

Reputation:

Maybe this helps:

One thing that happens when a sound is played is that the power management blocks the computer to go to sleep. With pmset -g you can see all the Power Management stuff that is going on.

So, when sleep is prevented by "coreaudiod" the machine is playing obviously some sound.

Here what pmset -g spits out when iTunes is playing:

Currently in use:
 womp                 0
 halfdim              1
 sms                  1
 hibernatefile        /var/vm/sleepimage
 gpuswitch            2
 networkoversleep     0
 disksleep            10
 sleep                10 (sleep prevented by iTunes, coreaudiod)
 hibernatemode        3
 ttyskeepawake        1
 displaysleep         10
 acwake               0
 lidwake              1


Upvotes: 9

Related Questions