- Create a new project and add the code of
waveIn.cpp.
- Modify the project properties so that
- Character Set is Not Set
- Linker Input includes "winmm.lib".
- The "wavfile.wav" is located in the same directory as your
source file "waveIn.cpp". Right-click the WAV file to play it.
- When you can record and save the audio successfully, let's take a
look at these
Waveform Functions.
- Observe the size of that WAV file. How much does it differ from
the soundBuffer in memory?
- Try to modify the sampling rate or time length of your recording,
and see whether the size difference is constant.
- Modify the program and call
fwrite(3)
to save the contents of your soundBuffer to a file, e.g., buffer.bin.
Dump the WAV file and the buffer.bin. Compare their
contents.
- Silent your microphone and record again. Did you observe anything
in the data?
- The beginning bytes in a WAV file is called its "header".
In next week, we are going to explore this topic.
Please take a look at
WAVE PCM soundfile format before the class.