This particular problem is that when attempting to send Loopback audio from one PC to another, the audio buffers and stalls for fractions of a second; micro stutters occur.
Using the example from NAudio's ReadFullyStream sends the audio with no hitches, only that upon processing, it will pause for the length of a second or two.
Server:
private void Capture_DataAvailable(object sender, WaveInEventArgs e)
{
stream.Write(e.Buffer, 0, e.BytesRecorded);
}
and client:
wave = new WaveOut()
{
DesiredLatency = 500
};
wave.Init(buff); //BufferedWaveProvider
wave.Play();
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
{
buff.AddSamples(buffer, 0, read);
}
The code I am using is painfully simplified, and is using Tcp since I put it together before I knew Udp was the preferred choice.
The current result is that audio plays, but stutters every half-second or so.
A network using UdpClient
solved the microstuttering, although it did not resolve stuttering altogether. This might be accomplished by sending audio as encoded Mp3 and decoding it client-side. As it stands, it is sending uncompressed data live with minor gaps.