1
votes

I've had this crazy idea of an application: there would be two devices. One device would take microphone input, send the raw PCM bytes over the network to the other device and application on on it would would make the device think that those sounds came from the microphone. I've managed to write everything except for the feeding bytes as sound input part.

I've been searching the web for quite a while, and I couldn't find anything: looks like I don't know how to name the problem correctly.

The receiver is written in native C++ with C# WPF Wrapper for GUI. Does anyone know a way I could solve this problem through either Win32 API or maybe there's such functionally in .NET?

1
It's a bit hard to tell exactly what you want by "the feeding bytes as sound input part": (a) getting the PCM input (ie the raw 'bytes' data) from the microphone; (b) sending data over the network; (c) playing them on the other computer; (d) making a microphone device on the remote computer which plays back the bytes...? - David
(d) is the thing I want. I already successfully got PCM bytes from one computer, sent it over the network to the second one, however, I have no idea how to make that sound appear as microphone input to the second PC. - Sunius
In that case you probably need to create a microphone device, with a kernel driver (?) or use one of the Windows Core Audio APIs - David
I looked for Windows Core Audio API that fit my needs yet I couldn't find anything useful neither before nor now (maybe I missed something?). As for driver... I guess that's out of my league :/. - Sunius
@Sunius when you say "sound appear as microphone input to the second PC" would playback of the RAW PCM through the speakers be enough, or is there some other reason why you would want to "fake" a microphone. - Matt Johnson

1 Answers

3
votes

You need 2 things:

  1. implement a PortCI-compliant driver: see http://msdn.microsoft.com/en-us/library/windows/hardware/ff536829(v=vs.85).aspx as a start point
  2. use this driver in your application to perform whatever audio functions you need.

At step 1 you have to write an audio adapter driver which will use some existing kernel drivers for working with network adapters. By the way, here you'll have to take care not to "steal" unwanted packets from the network. You have to think of some way of determining which packets are audio packets and which not. Maybe in a first step you use one dedicated network driver only for this.

Working at kernel level is recommended in order for your "custom network audio device" to be seen as an audio device by the OS. Windows offers a decent API for treating your bytes as audio bytes, apply filters on them, etc (see also http://msdn.microsoft.com/en-us/library/windows/hardware/ff538901(v=vs.85).aspx for more on this)