#audio-playback #audio #playback #gamedev

kittyaudio

An audio playback library focusing on simplicity

11 releases

0.2.0 Jan 29, 2025
0.1.9 Feb 6, 2024
0.1.8 Jan 31, 2024
0.1.7 Dec 30, 2023
0.1.3 Nov 30, 2023

#37 in Multimedia

Download history 1/week @ 2024-11-21 1/week @ 2024-11-28 11/week @ 2024-12-05 23/week @ 2024-12-12 67/week @ 2025-01-23 62/week @ 2025-01-30 8/week @ 2025-02-06

137 downloads per month

Unlicense OR MIT OR BSL-1.0

80KB
1.5K SLoC

🐱 kittyaudio

docs.rs Downloads on Crates.io

crates.io | docs.rs | examples | changelogs

kittyaudio is a Rust audio playback library focusing on simplicity, speed and low-latency audio playback.

Installation with cargo:

cargo add kittyaudio

Example

use kittyaudio::{include_sound, Mixer};

fn main() {
    // include a sound into the executable.
    // this type can be cheaply cloned.
    let sound = include_sound!("jump.ogg").unwrap();

    // create sound mixer
    let mut mixer = Mixer::new();
    mixer.init(); // use init_ex to specify settings

    let playing_sound = mixer.play(sound);
    playing_sound.set_volume(0.5); // decrease volume

    mixer.wait(); // wait for all sounds to finish
}

Features

  • Low-latency audio playback
  • Cross-platform audio playback (including wasm)
  • Handle device changes or disconnects in real time
  • Low CPU usage
  • Minimal dependencies
  • Minimal memory allocations
  • No panic!() or .unwrap(), always propogate errors
  • No unsafe code
  • Simple API, while being customizable
  • Optionally use Symphonia to support most audio formats
  • Feature to disable audio playback support, if you want to use kittyaudio purely as an audio library
  • Commands to change volume, playback rate, position and panning in the sound with easings
  • Loops, and commands to change them with easings

Roadmap

Those features are not implemented yet.

  • Effects (reverb, delay, eq, etc.)
  • C API
  • Audio streaming from disk

Dependencies

~5–33MB
~551K SLoC