Skip to main content

voice_crossing

Function voice_crossing 

Source
pub fn voice_crossing(possibility: &[Pitch]) -> bool
Expand description

Whether any part sings higher than a part above it.

use music21_rs::Pitch;
use music21_rs::figuredbass::possibility::voice_crossing;

let pitches = |names: &[&str]| -> Vec<Pitch> {
    names.iter().map(|name| Pitch::from_name(*name).unwrap()).collect()
};
assert!(!voice_crossing(&pitches(&["G5", "C5", "E4", "C4"])));
assert!(voice_crossing(&pitches(&["C5", "G5", "E4", "C4"])));