20 breaking releases

Uses old Rust 2015

0.25.0 Nov 29, 2016
0.23.1 Sep 24, 2016
0.21.0 Jul 10, 2016
0.15.0 Mar 1, 2016
0.0.3 Nov 26, 2014

#341 in Graphics APIs

Download history 30/week @ 2023-08-04 34/week @ 2023-08-11 44/week @ 2023-08-18 47/week @ 2023-08-25 27/week @ 2023-09-01 57/week @ 2023-09-08 55/week @ 2023-09-15 7/week @ 2023-09-22 23/week @ 2023-09-29 27/week @ 2023-10-06 31/week @ 2023-10-13 41/week @ 2023-10-20 82/week @ 2023-10-27 34/week @ 2023-11-03 33/week @ 2023-11-10 35/week @ 2023-11-17

189 downloads per month


860 lines


Build Status crates.io Crates.io

Rust bindings for SDL2_mixer.


Rust-SDL2_mixer is a library for talking to the new SDL2_mixer library from Rust.

Rust-SDL2_mixer uses the MIT licence.


  • Rust-SDL2
  • SDL2_mixer development libraries
  • Latest stable Rust master


brew install sdl2_mixer --with-flac --with-fluid-synth --with-libmikmod --with-libmodplug --with-libvorbis --with-smpeg2


  1. Download mingw development libraries from https://www.libsdl.org/projects/SDL_mixer/ (SDL2_mixer-devel-2.0.x-mingw.tar.gz)

  2. Unpack to a folder of your choosing (You can delete it afterwards).

  3. Copy all lib files from


    to (for Rust 1.6 and above)

    C:\Program Files\Rust\lib\rustlib\x86_64-pc-windows-gnu\lib

    or to (for Rust versions 1.5 and below)

    C:\Program Files\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib

    or to your library folder of choice, and ensure you have a system environment variable of

    LIBRARY_PATH = C:\your\rust\library\folder

    For Multirust Users, this folder will be in

    C:\Users{Your Username}\AppData\Local.multirust\toolchains{current toolchain}\lib\rustlib\x86_64-pc-windows-gnu\lib

  4. Copy SDL2_mixer.dll and smpeg2.dll from


    into your cargo project, right next to your Cargo.toml.


Place the following into your project's Cargo.toml file:

sdl2_mixer = "0.24.0"

Or, to depend on the newest rust-sdl2_mixer, reference the repository:

git = "https://github.com/andelf/rust-sdl2_mixer"

You can also just clone and build the library yourself:

git clone https://github.com/andelf/rust-sdl2_mixer
cd rust-sdl2_mixer
cargo build
# TODO: OR if you are using the mac framework version
rustc --cfg mac_framework src/sdl2_mixer/lib.rs

If you're not using Cargo, you can compile the library manually:

git clone https://github.com/andelf/rust-sdl2_mixer
cd rust-sdl2_mixer
rustc src/sdl2_mixer/lib.rs


A simple demo that plays out a portion of a given music file is included:

cargo run --example demo path/to/music.(mp3|flac|ogg|wav)


Licensed under either of


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~362K SLoC