Barix. Record/play back file

Subscribe to RSS news feed

The article describes how to record and play back WAV file with Barix Annuncicom/Exstreamer/Instreamer device using the VCX library for Visual Studio (C#, Visual Basic .NET, Visual Basic 6.0 or Visual C++ 6.0).


Binary : sample_directstream_wav.zip
C#: sample_directstream_wav_source_csharp.zip
VB.NET: sample_directstream_wav_source_vbnet.zip
VB: sample_directstream_wav_source_vb.zip
C++: sample_directstream_wav_source_vc.zip

Setup

Proper audio streaming to Barix Annuncicom (Exstreamer, Instreamer) requires the identical audio settings on the Annuncicom and your program sides. Make sure you have the same codec/bitrate selected in the program...

Click for full sized image

...and Annuncicom control panel (Encoding select):

Click for full sized image

Your WAV file can be any sampling rate. The demo application adjusts the WAV file sampling rate to the Barix Annuncicom sampling rate automatically.

Play back WAV file with Barix Annuncicom

Use Stream to device control group in the demo program. Make sure that the network settings are correct: UDP/port/device IP in the program and UDP receiver port in the Annuncicom control panel:

Click for full sized image

Enter a file name to play back to the corresponding text box. Press the Talk and Stop buttons in the program to send/stop sending audio to your Barix Annuncicom device.

Record WAV file from Barix Annuncicom

Use Listen to device control group in our demo. Make sure that the network settings are correct: TCP or UDP/port in the program and Streaming table (protocol/IP/port) in the Annuncicom control panel:

Click for full sized image

Enter a file name to record to the corresponding text box. Press the Listen and Stop buttons in the program to receive/stop receiving audio from your Barix Annuncicom device.

Programming background

1) Record file from Barix Annuncicom. Use the following component chain:

IpServer > Codec > WaveRiff

IpServer receives audio stream, Codec decodes it, WaveRiff writes audio stream to a WAV file.

2) Play back file with Barix Annuncicom. Use the following component chain:

WaveRiff > Resampler > Codec > IpClient

WaveRiff reads your WAV file, Resampler adjusts the WAV file sampling rate to your Barix Annuncicom one, Codec encodes it, IpClient sends it to Barix Annuncicom.

3) Set IpServer.StreamingMode and IpClient.StreamingMode = RAW.

4) When you select a codec or change the sampling rate value, set the Codec.FormatTag and Codec.PcmSamplesPerSec values accordingly.

Codec.FormatTag = 1 if you stream in the PCM format (aLaw = 6, uLaw = 7, MPEG = 85).

5) When you play back a WAV file, you have to use the Resampler component to adjust your WAV file sampling rate. Set Resampler.Dst... = Codec.Pcm... properties to ensure that the Resampler output audio stream has the same format as your Codec component.

6) When you play back a WAV file, set WaveRiff.RealTime = True. Set WaveRiff.Loop = True if you want to play back your WAV file more than once.

Read more about Barix support