Create and Play .Wav Format Files

The sample code linked to this page consists of a VB module containing a collection of routines that you can use to create and play wav format sound files.

While the code simply creates sine waves it provides the basic layout of the wav file. The routine Wav_BuildHeader creates the wav file header based on given parameters (sample rate, resolution, audio mode) in a byte array. Sample sine wave routines demonstrate the construction of the data. The wav files can be contained entirely in memory. You can also write the newly created wav file to disk using the Wav_WriteToFile routine.

Playback of the wav files is accomplished by invoking the canned functionality of the MultiMedia DLL winmm.dll.

By stepping through the code behind the sample form you can see how to call the various routines in the .bas module.

Create and play wav format files.
Download Source Code

Developed By

This sample was created and submitted by David M. Hitchner. If you have any questions or comments concerning these routines, David can be reached at


Download this project and run it. Step through the routines in the .BAS module to get a full understanding of how the code works.

About TheScarms
About TheScarms

Sample code
version info

If you use this code, please mention ""

Email this page

© Copyright 2024 TheScarms
Goto top of page