Audio Streaming Latency
- by killianmcc
I'm writing a UDP local area network video chat system and have got the video and audio streams working. However I'm experiencing a little latency (about half a second) in the audio and was wondering what codecs would provide the least latency. I'm using NAudio (http://naudio.codeplex.com/) which provides me access to the following codecs for streaming;
Speex Narrow Band (VBR)
Speex Wide Band (16kHz)(VBR)
Speex Ultra Wide Band (32kHz)(VBR)
DSP Group TrueSpeech (8.5kbps)
GSM 6.10 (13kbps)
Microsoft ADPCM (32.8kbps)
G.711 a-law (64kbps)
G.722 16kHz (64kbps)
G.711 mu-law (64kbps)
PCM 8kHz 16 bit uncompressed (128kbps)
I've tried them out and I'm not noticing much difference. Is there any others that I should download and try to reduce latency? I'm only going to be sending voice over the connection but I'm not really worried about quality or background noises too much.
UPDATE
I'm sending the audio in blocks like so;
waveIn = new WaveIn();
waveIn.BufferMilliseconds = 50;
waveIn.DeviceNumber = inputDeviceNumber;
waveIn.WaveFormat = codec.RecordFormat;
waveIn.DataAvailable += waveIn_DataAvailable;
void waveIn_DataAvailable(object sender, WaveInEventArgs e)
{
if (connected)
{
byte[] encoded = codec.Encode(e.Buffer, 0, e.BytesRecorded);
udpSender.Send(encoded, encoded.Length);
}
}