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.

Playing with sound in C

Playing with sound in C - C Tutorial

From the course: Code Clinic: C

Start my 1-month free trial

Playing with sound in C

- [Instructor] The standard C Library lacks functions for using the mouse or accessing sound hardware. To program such features, you must venture out into the internet, and look for a suitable library. I might add that sound hardware is very specific, and not the easiest thing to code. Rather than learn how to program sound by using an operating system's API, I chose the PortAudio Library. Available at PortAudio.com, the PortAudio Library bills itself as free, cross platform, and open source, and it's actually a great little library. The problem is that PortAudio is designed to record and play sound snippets. It doesn't support routines to generate tones, although you can create such routines, which is what I did. And while it has sound on and sound off functions, you can't change the sound while it's playing. Further, the documentation recommends that your code not do anything serious while a sound is playing. That's pretty limiting, but it's often what C Programmers have to…

Contents