Read WAV file using C/C++

UPDATE : Source code has moved to a git repository, http://github.com/dilawar/sound . The project README file has the updated instructions. Instructions here may be outdated. This post is for demo purposes only.

This work is a derivative of Dr. Taylor’s work http://people.msoe.edu/~taylor/examples/wav.htm . There was a bug in his implementation which is removed from this implementation.

A C++ class to read WAV file and store its content in an array. We also store these values in an ASCII file and plot it using gnuplot to check whether we get it right. praat can be used to confirm whether our output is right or not. Google to read about the WAV format. We only support a non-compressed WAV file.

WAV File Format

We do not support the compressed WAV file. The format which is programmed here is available here https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.

Implementation

The Makefile project can be found at github repository http://github.com/dilawar/sound .  After compilation (using make all), you’ll get the binary parseSpeech. Use this binary ./parseSpeech -f . If your wav file is long (more than 3-4 seconds) the txt file generated by this program speechData.txt will be very lengthy. Use can use gnuplot to draw the waveform.

Results


5 comments

Leave a Reply