| Crates.io | ash_audio |
| lib.rs | ash_audio |
| version | 0.1.1 |
| created_at | 2025-12-08 10:12:02.539871+00 |
| updated_at | 2025-12-08 10:12:02.539871+00 |
| description | A lightweight, modular audio system for games — Tier 1 (simple, indie-friendly) |
| homepage | |
| repository | https://github.com/yourusername/ash_audio |
| max_upload_size | |
| id | 1973202 |
| size | 85,099 |
A lightweight, modular audio stack for Rust games, targeting Tier 1 needs (indie & AA). It focuses on clarity, extensibility, and fast iteration while leaving room to evolve into AAA-level features in Tier 2.
cpal 0.16.Vec3 math.archetype_ecs integration feature flag to wire the manager into entity systems.[dependencies]
ash_audio = { version = "0.1.1", features = ["archetype-ecs"] } # optional features
archetype-ecs if you just need the runtime manager.use ash_audio::prelude::*;
fn main() -> Result<()> {
let mut manager = AudioManager::new()?;
// Either load from disk or from memory.
manager.play_sound("assets/music.ogg", "music")?;
manager.set_mix_state("gameplay")?;
println!("Active voices: {}", manager.active_voices());
Ok(())
}
let mut manager = AudioManager::new()?;
manager.set_bus_volume("sfx", 0.5)?;
manager.set_mix_state("paused")?; // applies preset volumes (dialog louder, music ducked)
use ash_audio::types::Vec3;
let mut manager = AudioManager::new()?;
manager.set_listener_position(Vec3::new(0.0, 0.0, 0.0));
manager.set_listener_forward(Vec3::new(0.0, 0.0, 1.0));
let handle = manager.play_sound("assets/ambient.wav", "sfx")?;
manager.set_sound_position(handle, Vec3::new(5.0, 0.0, 2.0))?;
src/
audio_manager.rs # High-level API
backend/ # Backend trait + CPAL implementation
bus/ # Bus structs + manager
codec/ # WAV/OGG/FLAC decoders + registry
mix_state/ # Mix state definitions + manager
spatial/ # Stereo helpers
voice/ # Voice handles + manager
examples/
basic_playback.rs
mix_states.rs
spatial_audio.rs
tests/
integration_tests.rs
codec_tests.rs
Run any example with cargo:
cargo run --example basic_playback
cargo run --example mix_states
cargo run --example spatial_audio
Provide your own audio assets under assets/ (paths referenced inside each example).
cargo fmt --all
cargo clippy --all-targets --all-features
cargo test --all-features
Codec tests synthesize WAV buffers, so no external data is required.
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Made with ❤️ by Saptak Santra and contributors.