Skip to content

[Feature] Sound file loading (WAV, OGG) #111

Description

@vmarcella

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 SoundBuffer type 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 hound crate for WAV decoding
  • Consider lewton crate for OGG Vorbis decoding
  • Store samples as f32 internally for mixing flexibility

Activity

  1. added
    enhancement
    lambda-rs-platform
    audio
    on Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    audioenhancementlambda-rs-platform

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions