soloud-rs
A crossplatform Rust bindings for the soloud audio engine library.
Supported formats: wav, mp3, ogg, flac. The library also comes with a speech synthesizer.
Usage
[]
= "1"
Or to use the git repo:
[]
= { = "https://github.com/moalyousef/soloud-rs" }
To play audio:
use *;
To play speech:
use *;
To add a filter:
use *;
The examples can be found in the soloud/examples directory. They can be run using:
$ cargo run --example simple
$ cargo run --example speech
$ cargo run --example filter
$ cargo run --example load_mem
You will need to have valid "sample.wav" and "Recording.mp3" audio files in the project root. Or you can change the paths to point to any supported audio file.
There is also a demo gui application (using fltk) here.
Dependencies
A Rust compiler, C++ compiler, Cargo, CMake and git (all these need to be in your PATH). Ninja is recommended, but not required, and will be used if found. This crate uses the miniaudio backend by default which assumes default sound drivers are functional.
Backends
The default backend is miniaudio, however Soloud supports several backends to varying degrees. To enable support of a certain backend, alsa for example:
[]
= { = "1", = false, = ["alsa"] }
This also assumes that those libraries headers are in your include path where CMake can find them, otherwise you can set it via the command line (posix):
$ export CXXFLAGS="-I /path/to/include"
or for Windows:
$ set CXXFLAGS="-I C:\\path\\to\\include"
The same can be done for CFLAGS if needed.
Supported backends:
- miniaudio
- oss
- alsa
- sdl2
- sdl2-static
- portaudio
- openal
- xaudio2
- winmm
- wasapi
- opensles
- coreaudio
- jack
Android support
The ANDROID_SDK_ROOT and ANDROID_NDK_ROOT need to be set.