From the course: Code Clinic: C++

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Generate sounds with libao

Generate sounds with libao - C++ Tutorial

From the course: Code Clinic: C++

Start my 1-month free trial

Generate sounds with libao

- To generate sounds, I decided to use Libao which is a cross platform library that's available from xiph.org. It's open source and provides a very simple API to play audio wave forms. It was also easy to install as a package within my Sigwhen environment. The Libao API only has a handful of functions. In my solution, I used the initialize function to initialize the library. The default driver id function to get the id number of the default output driver on my computer, and then the open live function to open a live play back audio device for output. After those configuration steps, I used the play function to output audio samples that I generate and store in a buffer. And at the end, I use the close and shut down functions to close the device and library. Now while this API is simple, its also very limited. There's not a built in way to repeatedly play an audio wave form on loop. But I need the sound to continue…

Contents