#time #conversion #music #dsp

time_calc

A library for music/DSP time conversions! Provides functions and methods for converting between ticks, ms, samples, bars, beats and measures

21 releases

Uses old Rust 2015

0.13.0 Oct 5, 2017
0.12.1 May 15, 2017
0.11.1 Apr 16, 2017
0.11.0 Jun 7, 2016
0.9.4 Dec 24, 2014

#60 in #dsp

Download history 44/week @ 2023-11-27 31/week @ 2023-12-04 34/week @ 2023-12-11 42/week @ 2023-12-18 28/week @ 2023-12-25 17/week @ 2024-01-01 105/week @ 2024-01-08 155/week @ 2024-01-15 56/week @ 2024-01-22 27/week @ 2024-01-29 111/week @ 2024-02-05 48/week @ 2024-02-12 85/week @ 2024-02-19 153/week @ 2024-02-26 86/week @ 2024-03-04 42/week @ 2024-03-11

375 downloads per month
Used in 9 crates (8 directly)

Apache-2.0/MIT

36KB
1K SLoC

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.

Dependencies

~0.5–1MB
~15K SLoC