#gamedev #music #sound #wav #thin #play #ogg

bin+lib oml-audio

Very basic, and thin abstraction of audio handling meant for games

23 releases

0.8.8-alpha Mar 16, 2024
0.8.6-alpha Jan 25, 2023
0.6.9-alpha Dec 12, 2022
0.6.5-alpha Apr 16, 2022
0.5.1 Jan 13, 2022

#286 in Game dev

Used in 2 crates (via oml-game)

MIT license

1.5K SLoC


Work in progress! API will change, but we'll obey semver rules. To be precise:

Pre 1.0.0

  • breaking changes will change the minor version (x.y.0)
  • non-breaking changes will change the patch level (x.y.z)

Post 1.0.0

  • breaking changes will change the major version (x.0.0)
  • non-breaking changes, additions will change the minor version (x.y.0)
  • fixes will change the patch level (x.y.z)

0.y.z will potentially change a lot!

Very thin wrapper for playing music, and audio in rust based games.


  • Play .mp3 music (with hardware acceleration) on macOS

  • Play .wav & .caf sound on macOS

  • Play .ogg music on windows

  • Play .wav sound on windows

  • Play .ogg music on linux

  • Play .wav sound on linux


  • Support other platforms (iOS, android, etc)

Breaking changes in 0.8.x

Newer versions allow compiling in multiple backends and selecting them at runtime. This has the downside of a breaking API change :( Audio::new, or rather Audio::create_default or Audio::create now return a Box<dyn AudioBackend> which might mean you have to change your storage. AudioBackend is also now generic over FileLoader.

Example :WIP:

use oml_audio::Audio;
use oml_audio::fileloader::FileLoaderDisk;

pub fn main() {
    let mut fileloader = FileLoaderDisk::new( "./data" ); // 'data' is the base directory for all other files/paths

    // OLD: let mut audio = Audio::new();
    let mut audio: Box<dyn AudioBackend<FileLoaderDisk>> = Audio::create_default(); // explicit type for verbosity only
    audio.load_sound_bank( &mut fileloader, "test.omsb" );

    audio.play_sound( "SOUND_ID" );

    loop {
        let _timestep = audio.update();

        // update
        // render
        // (maybe) yield/sleep