'How can I take control of the input stream of a (virtual) audio device in windows?

My wish is to send my audio into the microphone as the input, then ohter applications can receive my audio through it.

Solutions I found are:

  1. Stereo MIX.

  2. Virtual audio cable. I can only control the input stream through the VAC INPUT.

These two solutions partly meets my requirement. However, What I want is to directly control the input stream of the microphone.

And I think it's possible to achieve this by providing a communication endpoint like socket or providing an programming api to manually design the input of VMIC. If there any open source library supports these features?

I find a WO mic software in google, It looks like only a vitual microphone is setted, and the client software can send audio from phone into this VMIC. How does it connct with the driver, could it be possible to send my own audio through my program or script?

Update: I found that the communication between WO mic client(software) and driver is based on IRP(detected by IRPmon), How to find out the data format(like protocol) it used(Thus I can write my own software and reuse it's driver) and if there any open source driver with these kind of specificication documented?



Solution 1:[1]

Actually, none of these solutions "send audio into the microphone". Microphone is an audio input (recording) device, it only can produce audio signals/data, not receive them.

Both solutions mentioned add a separate audio input/recording "loopback" endpoint that can be used instead of the real microphone. If you need to mix signals from the microphone to such loopback channel, you must organize it explicitly.

And what exactly do you mean by the "directly control the stream"?

Solution 2:[2]

I'm also looking for a way to send specific data into the microphone's input stream (like an MP3 for example). I searched a lot of API for C# .net (like NAudio) or Python and couldn't find any.

But I think it's possible using C++ , with lower-level API, Core Audio.

https://docs.microsoft.com/en-us/windows/win32/coreaudio/core-audio-apis-in-windows-vista

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eugene Muzychenko
Solution 2 Rodrigo Petarli Brandão