Cross-platform microphone recording example

Home > Software > Cross-platform recording

Here is an example I developed to test recording audio from a microphone using the same code for both Windows and Linux. It uses the excellent open-source PortAudio library with the C++ wrapper. A makefile is provided for Linux and a Visual Studio 2005 solution for Windows.

The example is a simple command line program that:

  • Lists the details of all the audio devices found.
  • Plays a sine wave beep.
  • Records 16-bit 16kHz audio.
  • Saves the audio to a file (raw format).
  • Plays back the recording.
  • Allows input/output devices to be specified via command line arguments.

Files: Zip file containing the example.