Be vewy vewy quiet – we’we hunting wabbits.
— Elmer Fudd
This is a mini-app I’ve written to play silence to any given playback device using WASAPI event-driven (pull) mode.
>silence -? silence silence -? silence --list-devices silence --device "Device long name" With no arguments, plays silence to the default audio device. -? prints this message. --list-devices displays the long names of all active playback devices. --device plays silence to the specified device. >silence --list-devices Active render endpoints found: 2 Speakers (USB Audio Device) Headphones (High Definition Audio Device) >silence --device "Headphones (High Definition Audio Device)" Press Enter to quit... Received stop event after 488 passes
While it’s playing it shows up in the Volume Mixer:
Why would I write such a thing?
Well, there is the pedagogical exercise of writing a WASAPI event-driven render loop.
But there is also a practical application of an active silence stream, having to do with loopback capture. More on this in a future post…
EDIT: 7/30/2009 – fixed bug where I was treating the GetCurrentPadding value as the amount of free space in the buffer when in fact it’s the amount of used space.
While I was at it, added an icon and exited immediately on errors rather than waiting for the caller to hit Enter.
EDIT: 9/28/2015 – moved source to https://github.com/mvaneerde/blog/tree/master/silence