Windows virtual microphone in C

2019-08-31 17:52发布

问题:

I asked a similar question a while ago but I didn't know very much, so I wasn't able to be specific enough.

I want to write a program that takes input from my microphone, processes it, and then sends the output to a fake "virtual microphone" as if the processed sound I created was what a microphone was hearing. I would then like to be able to use this virtual microphone with any application that supports choosing your microphone input (pretty much any well written software) as a valid microphone. So what the application "hears" will be my processed version of the microphone input.

I'm working with Portaudio in C and I can capture from the mic, process, and send out to the speakers just fine. Now I need to replace my real speakers in the application with the phony microphone. Windows seems to have some APIs for this. http://msdn.microsoft.com/en-us/library/windows/hardware/ff536201%28v=vs.85%29.aspx So my sink pin will be the real microphone and I will have to create a NEW source pin that should be visible to other applications. How would I go about doing this? I'm having difficulty finding code samples or really even any very informative documentation.

Language: C OS: Windows 7

回答1:

It is possible to use the Windows Stereo Mix for that. Then you can open the virtual device in loopback mode and record what the microphone hears with programming



回答2:

I believe this would require writing a device driver, not merely working with Win32 APIs.

There is a similar question on SuperUser: How to create a virtual audio device and stream audio input with it. Their solution is to check out Virtual Audio Cable. However it is not free.

There are alternatives to Virtual Audio Cable, one of which being a Windows port of JACK.



回答3:

You could be using the programm called virtual audio cable. The freeware includes up to 3 vac-s. Afterward you can use the mitov.com audiolab library to do whatever you want with the sound comming on it. If you want to do some DSP or whatever