A library for music/DSP time conversions! Provides functions and methods for converting between ticks, ms, samples, bars, beats and measures.
Rust
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples Rename TimeSig::beats_in_a_bar to beats_per_bar. Add TimeSig::ticks_p… May 14, 2017
src Remove commented out serde import Oct 5, 2017
.gitignore
.travis.yml Update travis for testing with serde 1.0 Oct 5, 2017
Cargo.toml
LICENSE-APACHE Add local copies of license Apr 3, 2016
LICENSE-MIT
README.md

README.md

time_calc Build Status

A library for music/DSP time conversions!

time_calc provides functions and methods for converting between ticks, ms, samples, bars, beats and measures.

It looks like this:

const SAMPLE_HZ: SampleHz = 44_100.0;
let bpm: Bpm = 120.0;
let time_sig = TimeSig { top: 4, bottom: 4 };
println!("Convert 4 bars to samples where the tempo is 120bpm, the time signature is 4/4
         and the sample rate is 44,100 samples per second: {}",
         Bars(4).samples(bpm, time_sig, SAMPLE_HZ))

Usage

Add time_calc to your cargo dependencies like this:

[dependencies]
time_calc = "*"

See the example for a better demo.