Skip to main content

slash_mixed_to_fraction

Function slash_mixed_to_fraction 

Source
pub fn slash_mixed_to_fraction(
    value: &str,
) -> Result<(Vec<(UnsignedIntegerType, UnsignedIntegerType)>, bool), SlashError>
Expand description

A meter written with or without a denominator on each part as the ratio of each part, and whether any numerator borrowed the next denominator, as in 3+2/8: music21’s slashMixedToFraction.

use music21::meter::tools::slash_mixed_to_fraction;

let (parts, summed) = slash_mixed_to_fraction("3+2/8+3/4").unwrap();
assert_eq!(parts, [(3, 8), (2, 8), (3, 4)]);
assert!(summed);

§Errors

SlashError::TimeSignature for a part with a slash that is no ratio, SlashError::Unreadable for a bare numerator that is no number, and SlashError::Meter for a numerator with no denominator after it.