Symphonium
An unofficial easy-to-use wrapper around Symphonia for loading audio files. It also handles resampling at load-time.
The resulting DecodedAudio resources are stored in their native sample format whenever possible to save on memory, and have convenience methods to fill a buffer with f32 samples from any arbitrary position in the resource in realtime during playback. Alternatively you can use the DecodedAudioF32 resource if you only need samples in the f32 format.
Example
/// A struct used to load audio files.
let mut loader = new;
/// Load an audio file.
let audio_data = loader
.load
.unwrap;
/// Fill a stereo buffer with samples starting at frame 100.
let mut buf_l = vec!;
let mut buf_r = vec!;
audio_data.fill_stereo;
/// Alternatively, if you don't need to save memory, you can
/// load directly to an `f32` format.
let audio_data_f32 = loader
.load_f32
.unwrap;
/// Print info about the data (`data` is a `Vec<Vec<f32>>`).
println!;
println!;
Features
By default, only wav and ogg support is enabled. If you need more formats, enable them as features in your Cargo.toml file like this:
symphonium = { version = "0.7.1", features = ["mp3", "flac"] }
Available codecs:
aacadpcmalacflacmp1mp2mp3pcmvorbis
Available container formats:
cafisomp4mkvoggaiffwav
Alternatively you can enable the all feature if you want everything, or the open-standards feature if you want all of the royalty-free open-source standards.