Skip to main content

find_consecutive_scale

Function find_consecutive_scale 

Source
pub fn find_consecutive_scale(
    source: &Stream,
    scale: &Scale,
    options: &ScaleRunOptions,
) -> Result<Vec<ScaleRun>>
Expand description

Every run of notes in a stream going one way through a scale, a degree at a time, that reaches at least as many different degrees as asked: music21’s findConsecutiveScale.

The stream’s own notes are read in order, its chords, rests and streams passed over – so a rest never breaks a run, whatever music21’s restsAllowed says, since it never reads one. A run is greedy: it goes on as long as the next note continues it. A note off the scale ends a run; a note on it that does not continue the run ends it and starts the next.

§Errors

A scale its pitches cannot be read in, or a run asked for of fewer than two degrees, which music21 cannot tell the way of.