-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
audioAll things related to audioAll things related to audioenhancementNew feature or requestNew feature or requestlambda-rs-platformIssues pertaining to the dependency & platform wrappersIssues pertaining to the dependency & platform wrappers
Description
Overview
Add the ability to load audio files from disk into memory buffers suitable for
playback. Support common formats starting with WAV and OGG.
Current State
No audio file loading exists. The engine cannot read any audio formats.
Scope
Goals:
- Load WAV files into audio buffers
- Load OGG Vorbis files into audio buffers
- Provide
SoundBuffertype holding decoded audio data - Support loading from file path and from memory bytes
Non-Goals:
- MP3 support
- Streaming large files
- Audio playback
Proposed API
// crates/lambda-rs-platform/src/audio/buffer.rs
pub struct SoundBuffer {
samples: Vec<f32>,
sample_rate: u32,
channels: u16,
}
impl SoundBuffer {
pub fn from_wav_file(path: &Path) -> Result<Self, AudioError>;
pub fn from_wav_bytes(bytes: &[u8]) -> Result<Self, AudioError>;
pub fn from_ogg_file(path: &Path) -> Result<Self, AudioError>;
pub fn from_ogg_bytes(bytes: &[u8]) -> Result<Self, AudioError>;
pub fn sample_rate(&self) -> u32;
pub fn channels(&self) -> u16;
pub fn duration_seconds(&self) -> f32;
}Acceptance Criteria
- Load mono and stereo WAV files (16-bit, 24-bit, 32-bit float)
- Load OGG Vorbis files
- Return meaningful errors for unsupported formats
- Unit tests with small test audio files
- Example loading a sound file
Affected Crates
lambda-rs-platform
Notes
- Consider
houndcrate for WAV decoding - Consider
lewtoncrate for OGG Vorbis decoding - Store samples as f32 internally for mixing flexibility
Metadata
Metadata
Assignees
Labels
audioAll things related to audioAll things related to audioenhancementNew feature or requestNew feature or requestlambda-rs-platformIssues pertaining to the dependency & platform wrappersIssues pertaining to the dependency & platform wrappers