https://github.com/thoren-d/timbre
A Rust audio library designed for composing real-time effects.
https://github.com/thoren-d/timbre
audio audio-library audio-processing game-audio rust
Last synced: over 1 year ago
JSON representation
A Rust audio library designed for composing real-time effects.
- Host: GitHub
- URL: https://github.com/thoren-d/timbre
- Owner: thoren-d
- License: mit
- Created: 2020-08-13T04:06:09.000Z (almost 6 years ago)
- Default Branch: develop
- Last Pushed: 2021-08-21T21:24:52.000Z (almost 5 years ago)
- Last Synced: 2025-03-18T06:51:27.673Z (over 1 year ago)
- Topics: audio, audio-library, audio-processing, game-audio, rust
- Language: Rust
- Homepage:
- Size: 101 KB
- Stars: 17
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
timbre
======
[](https://crates.io/crates/timbre)
[](https://docs.rs/timbre/)


timbre is an audio library designed for composing real-time effects.
Timbre is designed to establish a common interface and a decent-sized
library of effects and decoders for playing audio in real time. It is aimed
at eventually providing most of the audio functionality needed for game
programming, but should be flexible enough for other applications as well.
# Example
```rust
fn main() -> Result<(), Box> {
# std::env::set_var("SDL_AUDIODRIVER", "dummy");
use std::time::Duration;
use timbre::prelude::*;
// SDL setup.
let sdl = sdl2::init()?;
let audio = sdl.audio()?;
// Inputs
let mut microphone = timbre::drivers::Sdl2Input::new(&audio)?;
microphone.resume();
let music = timbre::decoders::WavDecoder::from_file("./assets/music-stereo-f32.wav")?;
// Apply effects
let microphone = timbre::effects::Echo::new(microphone.source(),
Duration::from_secs_f32(0.5), 0.6);
let music = timbre::effects::LowPass::new(music, 200.0);
// Mix them together
let mut mixer = timbre::effects::BasicMixer::new();
mixer.add_source(microphone.into_shared());
mixer.add_source(music.into_shared());
// Output
let mut speaker = timbre::drivers::Sdl2Output::new(&audio)?;
speaker.set_source(mixer.into_shared());
speaker.resume();
// std::thread::sleep(Duration::from_secs_f32(120.0));
Ok(())
}
```
# What's new in 0.3?
* Functions that can fail now return Result.
* New Error type.
# Roadmap
## 0.4
* Make effects generic to reduce number of `Arc>`.
* Make effects more mutable; give access to their source.
## 0.5
* Introduce 3D spatialization effect.
* Add Pan effect for stereo sources.