tempor 0.2.0

Tempo related utilities for Rust
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 0 items with examples
  • Size
  • Source code size: 14.46 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.23 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • coral

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));
        }
    }