Skip to main content

iterate_all_voice_leading_quartets

Function iterate_all_voice_leading_quartets 

Source
pub fn iterate_all_voice_leading_quartets(
    stream: &Stream,
    options: QuartetOptions,
) -> Result<Vec<VoiceLeadingQuartet>>
Expand description

Every VoiceLeadingQuartet in a stream, generally a score: music21’s iterateAllVoiceLeadingQuartets.

Wherever a note starts, each voice that moves there is paired with the note it came from, each voice holding through is paired with itself, and every two such pairs make a quartet. Only notes make one; a pair with a chord in it is passed over, as it is upstream.

The quartets come in the order of the score: by offset, then by part, the first-named voice being the earlier part. music21 orders the voices within an offset by a counter of when each note object was put into its stream, which says nothing about the music, so its order within an offset can differ; the quartets themselves are the same.

A voice comes from the first thing in its part at the nearest earlier offset where anything in that part starts. If that is not a note or chord – a rest, or a time signature standing where a note also starts – the voice has no pair there. That is music21’s reading and is kept.