pitch_calc 0.12.0

A library for musical pitch conversions! Provides functions and methods for converting between frequency, midi-step and letter-octave.
Documentation
use num::PrimInt as Int;

/// The modulo function (handles negatives differently to Rust's remainder `%` operator).
#[inline]
pub fn modulo<I: Int>(a: I, b: I) -> I {
    match a % b {
        r if (r > I::zero() && b < I::zero()) || (r < I::zero() && b > I::zero()) => (r + b),
        r => r,
    }
}