Skip to content

Send audio stream from the output device to input device

Jason Vanover

Asked Jan 20, 2015, 10:48 AM EST1 answer
Share
LinkedInX
0down votefavorite

I am working on a project where I am playing a wave file using naudio to someone over the phone through a softphone. The person making the call, wearing a usb headset (which is an external soundcard) would need to be able to speak along with the wave files. Right now I'm running a dual 3.5mm audio cable from the output into the input on the back of the computer to make this happen. This is making me have to use the onboard sound card for the wave and the head set for the person to speak which means I have to switch the default input audio device on-demand to allow the person to be heard or the wave to be heard. This causes issue with the softphone app depending on how its devices are set. I want to cut out the onboard soundcard altogether. I want to send both my wave audio and the person speaking, into the same input device.

When I play the audio this is the code I call:

Java
WaveStream waveStream = new WaveFileReader(@"C:\Users\Public\Music\tester.wav");
WaveOut waveOut = new WaveOut();
waveOut.DeviceNumber = int.Parse(device1);
WaveOut.Init(waveStream);
WaveOut.Play();

At this point I would love to not only send to the selected output device but also to an input device as well. Is there any simple ways I can do this? Thanks for your help in advance.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • +1
    I want to make sure I understood you correctly. You are trying to develop a kind of chat application (server and client), where you are streaming wave audio file from the server side to the client. And at the same time, the person at the server side can speak along with the wave file. And the person at the client side can hear the audio and the speech at the same time.
    Is this correct?
    If yes, I didn't try this approach before. But I think this might be applicable by streaming the wave and the speech on two different streams (from the server side). And at the client side, you can receive (playback) the streamed audio using two different player controls (two different ports). Or you need to find a way to mix the streamed audios (wave and speech) on one audio stream at the client side.
    There are some Multimedia toolkits in market that can help you doing this. I searched internet and found the following post that might help get you started:
    http://support.leadtools.com/CS/forums/41363/ShowPost.aspx
    +1