Crates.io | awedio |
lib.rs | awedio |
version | 0.4.1 |
source | src |
created_at | 2023-05-10 01:40:35.901553 |
updated_at | 2024-07-31 15:57:44.638467 |
description | A low-overhead and adaptable audio playback library |
homepage | |
repository | https://github.com/10buttons/awedio |
max_upload_size | |
id | 860952 |
size | 205,658 |
A low-overhead and adaptable audio playback library for Rust.
By default supports playing mp3, wav, flac, aac, ogg, qoa and all other formats supported by Symphonia.
Play a single sound file:
let (mut manager, backend) = awedio::start()?;
manager.play(awedio::sounds::open_file("test.wav")?);
Play a sound with adjustable volume controllable after playback has started:
use awedio::Sound;
let (mut manager, backend) = awedio::start()?;
let (sound, mut controller) = awedio::sounds::SineWav::new(400.0)
.with_adjustable_volume_of(0.25)
.pausable()
.controllable();
manager.play(Box::new(sound));
std::thread::sleep(std::time::Duration::from_millis(100));
controller.set_volume(0.5);
std::thread::sleep(std::time::Duration::from_millis(100));
controller.set_paused(true);
Sound
similar to Iterator
in the standard library.cpal
feature (on by default).Backends are implemented by pulling samples from a [BackendSource] such as the Renderer.
async
: Enable async features that depend on
tokio-synccpal
: Enable the cpal backend.symphonia-all
: Enable all formats and codecs supported by
Symphoniasymphonia-
: All feature flags of symphonia are re-exported with the symphonia-
prefix.hound-wav
: Enable wav decoding using Houndrmp3-mp3
: Enable mp3 decoding using rmp3qoa
: Enable qoa decoding using qoaudioBy default all features are enabled excluding hound-wav
and rmp3-mp3
since symphonia handles those formats by default.
Depending libraries should disable default features.
Built for creating activities for 10 Buttons, a screen-less tablet for kids. Purposefully kept generic to be usable in other contexts.
Thanks to the following audio playback libraries which inspired and were a reference for this library:
SoundList::new().pausable().with_adjustable_volume().controllable()
...This project is licensed under either of Apache License, Version 2.0 or MIT license at your option.
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.