Skip to main content

voice_crossings

Function voice_crossings 

Source
pub fn voice_crossings(possibility: &[Pitch]) -> Vec<(usize, usize)>
Expand description

Every pair of parts, as part numbers, where a higher part sings below a lower one: music21’s checker.voiceCrossing.

use music21::Pitch;
use music21::figuredbass::checker::voice_crossings;

let pitches: Vec<Pitch> = ["C5", "G5", "E4"]
    .iter()
    .map(|name| Pitch::from_name(*name).unwrap())
    .collect();
assert_eq!(voice_crossings(&pitches), [(1, 2)]);