Skip to main content

offset_runs

Function offset_runs 

Source
pub fn offset_runs(offsets: &[f64]) -> Vec<Range<usize>>
Expand description

The runs of neighbours standing at one offset, as music21’s OffsetIterator hands them out: each run the positions of elements next to one another in walking order whose offsets are equal. Two elements at one offset with another between them are two runs.

use music21::stream::iterator::offset_runs;

assert_eq!(offset_runs(&[0.0, 0.0, 1.0, 2.0, 2.0]), vec![0..2, 2..3, 3..5]);
assert!(offset_runs(&[]).is_empty());