VM Labs SDK Sample Code

\vmlabs\sample\audio\PlayWav

Copyright © 2000-2001 VM Labs, Inc.  All Rights Reserved

March 2, 2001


This sample demonstrates how to play audio samples in either WAV or AIFF format, and at different sample rates.

Filename Description
makefile MAKEFILE for building and running sample program.
pcmdata.s Assembler source that includes data file as a binary image.
sin500.pcm Data file containing raw PCM-encoded data of a 500hz sine wave.
wave.c Main program code for sample.
sample1.wav Audio Sample in MS Windows WAV format
sample2.wav Audio Sample in MS Windows WAV format
sample3.aif Audio Sample in Apple Interchange File Format
sample4.aif Audio Sample in Apple Interchange File Format

This sample demonstrates how to parse a WAV or AIFF file to locate the raw audio data contained within, and how to determine the proper sample rate and other information.

Please note that audio data in the WAV format is normally stored in little-endian format (aka "Intel" format) .  To account for this, the program will automatically convert a WAV sample from little-endian to big-endian format (aka "Motorola" format) the very first time the sample is played.  It then marks the data header so that the process is not repeated on subsequent playbacks.  The program loops to play the same audio data a few times, just to prove that nothing is getting corrupted.

AIFF files are structurally very similar to WAV files, but are normally stored in the big-endian format.  Therefore, no data conversion is required.  The AIFF header is parsed simply in order to determine the audio format and location of the raw audio data.

By design, the program will only properly play samples that are 16-bit mono, and uncompressed.  If the data is in any other format, it will not work.  However, aside from this restriction, please note that this program has not been extensively tested to ensure compatibility with all WAV and AIFF files.  It's possible that some files with additional information (such as markers from an audio editing program) may not work correctly.


Before attempting to load or run any of the SDK samples, make sure you have first read the Hitchhiker's Guide To NUON document.  

After that, if you're still having trouble getting this sample program to work,  click here to request assistance from developer support.

Click here for other online SDK documentation.