tags:

views:

200

answers:

6

Is there an API only for sound? API's such as Allegro or SDL provide too much for my needs. I simply need a library that can do something like:

InitSound();
Sound *door = LoadSound("door.wav");
PlaySound(door,volume);

It would also be great if it could support compressed formats such as vorbis or mp3.

Thanks

+1  A: 

what do you think portaudio it is portable cross-platform Audio API

Baget
+6  A: 

If you are use to using OpenGL then you might like to try OpenAL?

graham.reeds
Good point, indeed!
Albus Dumbledore
+3  A: 

I'm a big fan of SFML Library. It does provide additional Graphic and Network features, but what is relevant to this question, is that it also has neat Audio package.

Audio features are:

  • Uses hardware acceleration whenever possible
  • Can load and save standard sound formats : ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64
  • Can load all audio resources directly from files in memory
  • 3D sound spacialization
  • Easy interface for capturing audio
  • Manages memory efficiently, so that you don't have to worry about resources lifetime or storage
  • Supports streaming for big files ; you can even write your custom streaming class for any source (network, ...)
  • Supports multi-channels formats (mono, stereo, 4.0, 5.1, 6.1, 7.1)

Website: http://www.sfml-dev.org/

rochal
Boooo, you beat me by one minute. But yes, SFML is great.
Dragontamer5788
+2  A: 

I really like SFML, its written in C++ and follows most of the rules of good API design (RAII and so forth)

http://www.sfml-dev.org/tutorials/1.6/audio-sound.php

If you prefer a more "C-like" library, SDL needs to be mentioned.

Dragontamer5788
A: 

SDL_sound is very simple to use, and handles the decoding for you. If you used OpenAL, you would have to do the decoding yourself (last I used it, anyway). I actually prefer OpenAL for games, though.

Bob
A: 

If you are looking for a professional cross-platform sound design API and Authoring application, take a look at Audiokinetic Wwise. It can do much more than just play sounds. It has effects, complex sound logic system, sound layering, profiling, interactive music tools, etc... It provides ogg vorbis/mp3 support and is free for non-commercial projects.

decasteljau