Rust-Alto: alto — OpenAL 1.1 bindings


alto provides idiomatic Rust bindings for OpenAL 1.1 and extensions (including EFX).


Because Alto interacts with global C state via dynamic linking, having multiple versions of Alto in one project could lead to unsafety. Please make sure only one version of Alto is in your dependency tree at any given time.

API Usage

let alto = Alto::load_default()?;

for s in alto.enumerate_outputs() {
    println!("Found device: {}", s.to_str()?);

let device =; // Opens the default audio device
let context = device.new_context(None)?; // Creates a default context

// Configure listener
context.set_position([1.0, 4.0, 5.0]);
context.set_velocity([2.5, 0.0, 0.0]);
context.set_orientation(([0.0, 0.0, 1.0], [0.0, 1.0, 0.0]));

let source = context.new_static_source()?;

// Now you can load your samples and store them in a buffer with
// `context.new_buffer(samples, frequency)`;


  • Documentation?

    Nov 5, 2018

    I don't see a link to the rust docs for this library.

  • OpenAL 1.1 link in README is dead
    OpenAL 1.1 link in README is dead

    Sep 18, 2019

  • Add rustfmt.toml with hard_tabs set to true & run cargo fmt
    Add rustfmt.toml with hard_tabs set to true & run cargo fmt

    Mar 1, 2020

  • add a dynamic feature flag, allowing static linking if desired
    add a dynamic feature flag, allowing static linking if desired

    May 20, 2019

    On platforms like android, openalsoft can be linked to statically or dynamically. This feature flag allows deciding between the "emscripten" style static linking, or dynamic linking (default). Static linking can save a lot of space in the final APK, so android users will likely prefer it.

    Currently it is up to the client to figure out how to link statically to the openal implementation. This PR makes no attempt to build openal for android. Though, I may try to add that in the future (once I've worked out the kinks).

  • Add
    Add "alut" to this package?

    May 27, 2016

    ALUT adds some helper methods for initializing audio files and creating/binding a buffer. Is there a way you can get that added inside of this package so users don't have to resort to the boilerplate "alc" conventions?

  • Update to Rust pre-0.9
    Update to Rust pre-0.9

    Jan 2, 2014

    I'm not sure about the best way to handle enum transmutes now as well as how to pass link args, but at least it compiles with this change.

  • Compiling for MinGW-W64
    Compiling for MinGW-W64

    Aug 13, 2016

    I’ve been trying to compile the crate on mingw-w64 for hours. I haven’t found a way to make it through with the crate, so I downloaded openal-rs, add a local override to my project and changed the link target from #[link(name = "openal32")] to #[link(name = "openal")], because that’s what pkg-config expects if you pass it --libs openal.

    After our talk on IRC, you uploaded an upper-case version that will work for the native Windows installation but not for MinGW. What can we do about that?

  • Need alcGetCurrentContext() and alcGetContextsDevice() for library I'm writing.
    Need alcGetCurrentContext() and alcGetContextsDevice() for library I'm writing.

    Sep 27, 2016


    I need those two methods in order to properly implement the destructor for my Rust library. Is there a way that they can be added, please?

    Thank you!

  • Building alto on Emscripten
    Building alto on Emscripten

    Apr 3, 2017

    I recently tried to build a dummy project listing alto as one of its dependencies, targeting Emscripten with --target asmjs-unknown-emscripten, and it failed because libloading does not (yet) support Emscripten.
    I had reported this, but in the meantime, al-sys actually does not need the libloading dependency when target Emscripten, because there, "out-of-the-box" support for OpenAL is claimed (see this issue).

    My suggestion : When the target is Emscripten, fall back to simply declaring the FFI bindings, and disable the libloading dependency so that it builds successfully.