Coder Social home page Coder Social logo

timbre's Introduction

timbre

Crates.io Documentation GitHub CI

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

fn main() -> Result<(), Box<dyn std::error::Error>> {
    # 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<Mutex<...>>.
  • Make effects more mutable; give access to their source.

0.5

  • Introduce 3D spatialization effect.
  • Add Pan effect for stereo sources.

timbre's People

Contributors

thoren-d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.