C program to play an audio file

Can you give an example of code for playing an audio file in C, as well as what header files are needed? I am new to this concept .... I am interested to know this.

+5
source share
3 answers

You cannot do this only in C, you have to use something platform specific.

One way to do this in a way that still remains very portable is to use existing multimedia libraries such as SDL .

+3
source

See the best c linux audio library

On * nix: just print the raw audio file in / dev / audio

+3

You can use the PortAudio library. PortAudio is a free, cross-platform open source library with audio I / O. It allows you to write simple audio programs in "C" that will compile and run on many platforms, including Windows, Macintosh (8.9, X), Unix (OSS), SGI, and BeOS. PortAudio is designed to promote the exchange of sound synthesis software between developers on different platforms.

+3
source

All Articles