How determine physical state of the speakers

0

How to determine whether or not the speakers are turned on or off in bash script?

Speakers connected to PC via 3.5 jack.

kirill

Posted 2017-11-23T07:07:06.037

Reputation: 191

You can only detect jack insertion, not power state. – Ignacio Vazquez-Abrams – 2017-11-23T07:11:56.517

Speakers are not "turned on or off", they receive an analog signal that can be positive or negative, and is neutral at rest. With Pulseaudio, you can monitor what data is sent to one particular output (e.g. line-out for speakers), and see if it's non-zero by using sox or similar for a short bit of data. But you didn't say why you need that, so that may not be the solution you want. – dirkt – 2017-11-23T07:15:09.253

I'm want run shell script when speakers power on. You will not be difficult to give a small example? – kirill – 2017-11-23T07:22:41.767

2Is your system actually capable of determining this (i.e., does anything happend when you switch them on)? It is likely that, as seen from the PC, there is no electrical difference whatsoever. – CL. – 2017-11-23T08:33:55.497

No answers