Programmed with <3 by Evan Balster
<plaid/audio> is a portable, extensible C++ framework for CPU-processed audio. It is designed chiefly for use in games and other media-intensive software.
It offers a free (zlib-licensed) alternative to commercial audio middleware like FMOD. Unlike the leading API, OpenAL, its behavior is consistent and guaranteed across platforms.
At present it offers classes for streaming and buffering audio files, playing back microphone input, manipulating streams with a selection of simple effects including pitch-changing, bandpassing and amplification, as well as mixing and splicing.
plaid/audio’s scheduling system synchronizes audio with the program’s framerate. It does this by dividing output into “timeslices” for each call to update(). This allows games to render their audio at their graphical framerate, with any changes in audio effects, synthesizers or samplers being audible every frame. Physics, animation or player input can thus have articulate audio feedback.
Documentation is available here as well as in the download package.
A Visual C++ example project is included, which plays a little song. It shouldn’t be hard to build for other platforms; the audio engine code has previously been compiled for Windows, OS X, Linux and iOS, and the provided implementation layer (portaudio) is compatible with all but the latter.
Special thanks go to Coby of Pixelscopic, who hired me for the work of separating this code from my game engine, the as-yet unreleased <plaid/gadget>, with the understanding that it would be opensourced thereafter. You, too, can hire me to expand features of the library or do other audio programming work.
plaidaudio_0.2.zip 588kb (alpha)
Demo Program (Windows) 237kb
Due to the early state of the project, backwards code compatibility is not guaranteed with future versions.
Notable issues at present:
– The only codec I’ve written is for OGG files. Further, it uses stb_vorbis, which can be a little picky about its input. If you control the files you use this isn’t a problem. I’ll accept codec contributions if they don’t add library dependencies.
– The Audio module expects wide strings for the purpose of specifying audio files. (My game engine is unicode, but yours probably isn’t)
Leave a Reply
You must be logged in to post a comment.