views:

891

answers:

5

I'm looking for a lightweight way to make my program (written in C) be able to play audio files on either windows or linux. I am currently using windows native calls, which is essentially just a single call that is passed a filename. I would like something similar that works on linux.

The audio files are Microsoft PCM, Single channel, 22Khz

Any Suggestions?

+1  A: 

You can try with this one: libao

Marc
libao looks nice, but unfortunately it is under the GPL.
quinmars
+3  A: 

SDL_Mixer, although not very lightweight, does have a simple interface to play WAV files. I believe, like SDL, SDL_Mixer is also LGPL.

OpenAL is another cross platform audio library that is more geared towards 3D audio.

Yet another open source audio library that you might want to check it out is PortAudio

codelogic
A: 

I've used OpenAL to play wav files as alerts/warnings in an Air Traffic Control system

The advantages I've found are

  1. it is cross platform
  2. works with C (and others but your question is about C)
  3. light weight
  4. good documentation available on the web
  5. the license is LGPL so you call the API with no license problems
hhafez
A: 

I like FMOD. The license is free for personal use, and very reasonable for small shareware or commercial projects

AShelly
A: 
quinmars