Read WAV file using C/C++

UPDATE : Source code is 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 purpose only.

This work is 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.
We give here c++ class to read WAV file and store its content in an array. We also store these values in a 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 non-compressed WAV file.

WAV File Format

We do not support compressed WAV file. 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. We are sorry for not giving an extensive documentation on this. 

Results

This slideshow requires JavaScript.

Advertisements

About Dilawar

Graduate Student at National Center for Biological Sciences, Bangalore.
This entry was posted in Programming, Technology and Engineering and tagged , . Bookmark the permalink.

One Response to Read WAV file using C/C++

  1. lanmanck says:

    Woo, It’s a great job, Thank you1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s