tempor

Crates.iotempor
lib.rstempor
version0.2.0
sourcesrc
created_at2021-06-07 01:48:46.557382
updated_at2021-06-07 01:56:58.042856
descriptionTempo related utilities for Rust
homepage
repository
max_upload_size
id407111
size14,983
coral (coral)

documentation

README

Tempor - Collection of tempo related utilities for Rust

This crate contains some utilities for dealing with tempo in Rust. Currently only the tempo tap utility but more to come.

Tapper

  • Simple utility for tapping tempo. Create a new tapper and call tap() which eventually returns Some(f64) representing the BPM.

    use std::thread;
    use std::time::Duration;
    use tempor::Tapper;
    
    fn main() {
        // 4 is number of taps until it averages
        // Duration is the cooldown from where it resets the counter
        let mut tapper = Tapper::new(4, Duration::from_secs(3)).unwrap();
    
        loop {
            match tapper.tap() {
                Some(v) => {
                    println!("BPM: {}", v);
                }
                None => {}
            };
    
            //120 BPM!
            thread::sleep(Duration::from_millis(500));
        }
    }
    
Commit count: 0

cargo fmt