VCX. Record or play back WAV file

Subscribe to RSS news feed

Describes how to write an application which records or plays back a WAV file using Visual Studio (C#, Visual Basic .NET, Visual Basic 6.0 or Visual C++ 6.0).


Binary : sample_wave_rec.zip
C#: sample_wave_rec_source_csharp.zip
VB.NET: sample_wave_rec_source_vbnet.zip
VB: sample_wave_rec_source_vb.zip
C++: sample_wave_rec_source_vc.zip

Record WAV file

Select a sound card. Press the "Quality" button to select a sampling rate, mono/stereo, etc. Enter a file name to record. Press the Start/Stop buttons to start/stop recording.

Click for full sized image

Play back WAV file

Select a sound card. Enter a file name to play back. Check the Loop option if you want to play back your file more than once Press the Start/Stop buttons to start/stop playback.

Click for full sized image

Display FFT bands

The demo also displays the FFT (Fast Fourier Transform) bands for left and right channels of recorded or played back audio stream.

Programming background

1) Record file

WaveIn > WaveRiff component chain is used.

WaveIn records audio stream from your sound card, WaveRiff writes audio stream to a WAV file.

2) Play back file

WaveRiff > WaveOut component chain is used.

WaveRiff reads your WAV file, WaveOut plays back audio stream on your sound card.

3) Display FFT bands

DisplayBands components receives audio from the WaveIn (recording audio) or WaveRiff (playing back audio) components:

recording: WaveIn > DisplayBands (left) / DisplayBands (right),

playback: WaveRiff > DisplayBands (left) / DisplayBands (right).