Crates.io | ez-audi |
lib.rs | ez-audi |
version | 0.3.0 |
source | src |
created_at | 2023-12-06 02:16:19.749827 |
updated_at | 2024-01-14 22:04:51.807532 |
description | A lightweight Linux/WASM compatible audio library based on cpal |
homepage | |
repository | https://github.com/AtmolanderMimi/ez-audi |
max_upload_size | |
id | 1059641 |
size | 91,959 |
A lightweight Linux/WASM compatible audio library based on cpal
Usage in WASM environment
)
(Windows is has not been tested yet)use ez_audi::audio_files::WavAudio;
use ez_audi::public_traits::*;
let wav_audio = WavAudio::build_from_path("test_assets/u8-stereo-lpcm.wav").unwrap();
// Creates an audio player, keep it in scope to keep the audio playing
let player = wav_audio.play_on_default_output(false).unwrap();
std::thread::sleep(std::time::Duration::from_secs(2));
Whilst ez-audi is fairly easy to use in WASM, there are some surprises:
Cursor
struct from std to turn a Vec
of bytes into a reader. Whilst the functions for building struct from files/paths still exists, they are useless in WASM.