Detect audio output

Started by cssyphus, December 05, 2021, 12:30:17 PM

Previous topic - Next topic

cssyphus

Not an urgent need, but it would be nice to add this into a small app I use...

Is it poss to detect if there is any audio output currently happening on the system? All I need is a boolean Yes/No...

Windows has the "Volume Mixer" (with multiple ways to open it*) that displays a real-time volume meter... is there any way to tap into that (or any other Windows service that could be used) just to see if audio is currently playing on the system?

Any thoughts/ideas where to look?  I've searched this tech support forum and the KnowledgeDB, but didn't find anything. Maybe someone has an idea how this might be done?

* Right-clicking on the speaker icon in the SysTray, also can be launched from command line [ C:\Windows\System32\SndVol.exe ]
Is this a pandemic... or an IQ test? newz.icu

td

Not sure that there is a method that doesn't involve some low level programming. Perhaps try a Web search using your search engine of choice.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

The WIL PlayMedia function does support querying specific device types' status. However, you would need to know the type of sound device you are targeting and not all devices support status commands. It would be more or less a trial and error process that may lead to frustration without satisfaction.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

cssyphus

Ah haaa... something to try. Thanks very much, Tony. I appreciate the info, and the feedback / expectation-management also. I'll give this a try, understanding that it may or may not work, and will advise my findings.
Is this a pandemic... or an IQ test? newz.icu

cssyphus

For future curious, Rob Latour of Ottawa Canada indulged a recent request to modify his freeware app, SetVol, to report on the presence/absence of sound within a (user-provided) sampling period. If sound is discovered it reports back immediately, otherwise it waits out the sampling-period (default 5sec) before reporting "Sound not detected".

Example:

setvol listen 0.5 > issound.txt

SetVol's original raison-d'etre was to allow command-line control over audio output. I've been using it with WinBatch for years, works great.

Ye can finde it here:

https://www.rlatour.com/setvol/
Is this a pandemic... or an IQ test? newz.icu