VCX. Peer-to-peer voice chat

Subscribe to RSS news feed

Describes how to write an audio chat application for peer-to-peer voice communication using Visual Studio (C#, Visual Basic .NET, Visual Basic 6.0 or Visual C++ 6.0).

Binary :


Select a sound card, specify a network protocol and port. Press the Quality button to select a codec and specify the other quality parameters: sampling rate, mono/stereo.

We recommend using the GSM or ADPCM codec (mono) for voice communication.

Use the Ready for chat checkbox to accept any incoming connection. Enter a remote IP address and press the Connect button to initiate a converstation with a remote side.

Click for full sized image

Send text messages

Enter a text message and press Enter to send your text message to the remote side.

Save your conversation to a WAV file

Enter a file name to the corresponding text box and check the Save to file option to save your conversation to the WAV file.

Silence detection

In order to decrease your network bandwidth usage you can use the silence detection approach, which is based on the dynamic speech processing methods. This means that only the bytes contaning the useful signal (your voice) are sent to the network.

Programming background

A single MediaGate component is used to accomplish all the tasks:

1) Accept incoming connections: MediaGate.Active = True.

2) Initiate a connection with a remote side: the MediaGate.Connect method.

3) Send/receive text: the MediaGate.SendText method and MediaGate.OnReceiveText event.

4) Save conversation to a WAV file: MediaGate.ConversationFileName, MediaGate.ConversationSaveToFile = True.

5) Turn on the silence detection:
MediaGate.SilenceDetectionMode = unasdm_DSP.

Technical details

MediaGate component incapsulates the following component chain:

WaveIn > Codec > IpServer / IpClient > Decodec > WaveOut

WaveIn records audio stream from your sound card, Codec encodes it, IpServer/IpClient receives/sends it via network, Decodec decodes it, WaveOut plays back audio stream on your sound card.