Skip to main content

measure_boundaries

Function measure_boundaries 

Source
pub fn measure_boundaries(
    positions: &[usize],
    last_valid: usize,
) -> Vec<(usize, usize)>
Expand description

music21’s _buildMeasureBoundaryIndices: the start and end of each measure from the places of its barlines, a span of one passed over.

use music21::abc::step::measure_boundaries;

assert_eq!(measure_boundaries(&[8, 12, 13, 16], 20), [(0, 8), (8, 12), (13, 16), (16, 20)]);