Recently i want to create a service on my pi which additional logic, one service needs to be stopped when the speaker is playing any sound. Any way i can get the status like a system log file about whether the speaker is being used?
if you use ALSA then this command should help you:
when nothing is playing the output is "closed" but when something is played it shows i.e. like this:
22:21:52 pi@sabaj-d5:~ $ cat /proc/asound/card*/pcm*p/sub*/hw_params
access: MMAP_INTERLEAVED format: S32_LE subformat: STD channels: 2 rate: 44100 (44100/1) period_size: 441 buffer_size: 1764 22:21:57 pi@sabaj-d5:~ $