Waveform Functions

  1. Create a new project and add the code of waveIn.cpp.
  2. Modify the project properties so that
  3. The "wavfile.wav" is located in the same directory as your source file "waveIn.cpp". Right-click the WAV file to play it.
  4. When you can record and save the audio successfully, let's take a look at these Waveform Functions.
  5. Observe the size of that WAV file. How much does it differ from the soundBuffer in memory?
  6. Try to modify the sampling rate or time length of your recording, and see whether the size difference is constant.
  7. 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.
  8. Silent your microphone and record again. Did you observe anything in the data?
  9. 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.