Skip to main content

Module search

Module search 

Source
Expand description

Runs of notes climbing or falling through a scale: music21’s alpha.analysis.search.

use music21_rs::alpha::analysis::search::{ScaleRunOptions, find_consecutive_scale};
use music21_rs::scale::{Scale, ScaleType};
use music21_rs::tinynotation::from_tiny_notation;
use music21_rs::Pitch;

let line = from_tiny_notation("4/4 a4 b c'# d' e' f'#")?.flatten();
let a_major = Scale::new(ScaleType::Major, Pitch::from_name("A4")?);
let runs = find_consecutive_scale(&line, &a_major, &ScaleRunOptions::default())?;
assert_eq!(runs.len(), 1);
assert_eq!(runs[0].elements.len(), 6);

Structs§

ScaleRun
A run found: the notes in it, by their place among the stream’s own elements, and the way it goes, where it has gone one.
ScaleRunOptions
music21’s keyword arguments to findConsecutiveScale.

Enums§

PitchAttribute
What two pitches must share to count as the same: music21’s comparisonAttribute.
RunDirection
Which way a run goes through the scale.

Functions§

find_consecutive_scale
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.