Skip to main content

fraction_to_slash_mixed

Function fraction_to_slash_mixed 

Source
pub fn fraction_to_slash_mixed(
    fractions: &[(UnsignedIntegerType, UnsignedIntegerType)],
) -> Vec<(String, UnsignedIntegerType)>
Expand description

Ratios as a meter writes them, numerators run together where neighbours share a denominator: music21’s fractionToSlashMixed.

use music21::meter::tools::fraction_to_slash_mixed;

let mixed = fraction_to_slash_mixed(&[(3, 8), (2, 8), (3, 4)]);
assert_eq!(mixed, [("3+2".to_string(), 8), ("3".to_string(), 4)]);