Hello all! Am new to c++ programming. I was given an assignment to convert a *.wav audio file into an ASCII text file that contains all the numbers corresponding to the sampled audio. Kindly tell me a program to convert the *.wav file into ASCII text file.
Do you have to code it from scratch, or are you allowed to use system calls? If so, what system are you working on?
If you want to output just the values of the sampled audio yourself, the first thing you need to do is reasd the WAVE header, to find out the offset to the data (and how it is encoded?).
Windows does provide multimedia support, including the "old school" MMIO functions, which can be used to load a wave file and access the data.
Thanks Andy for replying. Actually i have the following code that records a sound from the microphone and saves it as a .wav file. What i want is, to get the sample values written in a text file rather than saving it as .wav file. Kindly help me with this. Am using MS visual studio 2010. Here goes the code:
************************************************
// check1.cpp : Defines the entry point for the console application.
//
You just write the numbers out using ofstream. This snippet writes out the 16 bit values, one per line. ofs is an ostream object which has been successfully opened.
P.S. This code is assuming that the data block is an even number of bytes in size. For safety you might want to check this, even though it should be the csse (as you're using a 16-bit audio format)