I want to real time playing the audio microphone input.
If do it using DirectSound
. I can get the audio data from Buffer but I don't know how to play the data I get.
If do it using API: I got a C++
example this morning.
It's use some API functions such as "waveInOpen".But I know very little about C++
.And I don't know how to use these API functions in other programming language...
So what should I do?
You can use CSCore to do that:
private static void Main(string[] args)
{
using(var capture = new WasapiCapture())
{
capture.Initialize();
using(var source = new SoundInSource(capture))
{
using(var soundOut = new WasapiOut())
{
capture.Start();
soundOut.Initialize(source);
soundOut.Play();
Console.ReadKey();
}
}
}
}