tags:

views:

276

answers:

4

Hi,

Are there are any header files to be included to play audio file using C language.

+4  A: 

I advice you to take a look into SDL Sound. It is portable and include some control for the playback.

RageZ
+1  A: 

It depends on which platform you are going to play sound and what format you are playing. On GNU/Linux, you have various options like ALSA, Jack, PulseAudio and so on. On Windows, there may be win32 APIs to play audio.

If you have a simple raw samples, on GNU/Linux, you can "cat" the file to the audio device as well.

There are also platform independent APIs available which lets you use one single API and recompile the application on any platform.

Ramakrishnan Muthukrishnan
I am working on Mac OSX , xcode.
srikanth rongali
There seem to be some good documentation at http://tuvix.apple.com/audio. I haven't worked with OSX, but I would expect a well defined way to use Audio to exist in OSX
Ramakrishnan Muthukrishnan
+1  A: 

As RageZ suggested SDL is a nice crossplatform library. You can get more information from http://www.libsdl.org/

Anuraj
+3  A: 

On Mac OS X, the native audio API is CoreAudio. Apple provides some pretty good documentation for it on their site. It provides format converters for several common file formats too.

As mentioned above, you can also use SDL—SDL has the advantage of being more portable. CoreAudio is specific to Mac OS X.

LnxPrgr3
Rather than using CoreAudio another option would be to use OpenAL which is a quite nice audio API that is also cross platform compatible. I believe it supports more features (such as surround sound) than SDL so it might well be a better option for the OP depending on what their needs are.
Simon