Audio Streaming Latency

Posted by killianmcc on Stack Overflow See other posts from Stack Overflow or by killianmcc
Published on 2013-06-27T20:32:28Z Indexed on 2013/06/27 22:21 UTC
Read the original article Hit count: 183

Filed under:
|
|

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);
        }
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about audio