user292387
user292387

Reputation: 61

c program to play audio file

Can you give an example code to play an audio file in the C language, along with what header files are needed? I am new to this concept.... I am interested to learn this.

Upvotes: 6

Views: 12541

Answers (3)

You can use PortAudio library. PortAudio is a free, cross platform, open-source, audio I/O library. It lets you 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 intended to promote the exchange of audio synthesis software between developers on different platforms.

Upvotes: 5

Yktula
Yktula

Reputation: 14809

See best c audio library linux

On *nix: Simply print a raw audio file to /dev/audio

Upvotes: 4

unwind
unwind

Reputation: 399813

You can't do it in C alone, you're going to have to involve something platform-specific.

One way of doing that in a way that still remains very portable, is to use existing multimedia libraries, such as SDL.

Upvotes: 4

Related Questions