Skip to main content

Module tree

Module tree 

Source
Expand description

A stream’s elements as spans of time, and the moments where what sounds changes. A stream’s elements as spans of time, and the moments where what sounds changes: music21’s tree package, its timespan trees and verticalities.

as_timespans reads every element of a stream, nested ones included, as an ElementTimespan from where it starts to where it ends, with the streams it stands in; a TimespanTree answers which start, stop or sound at an offset; and a Verticality is one such offset, with the pitches sounding there.

use music21_rs::tinynotation::from_tiny_notation;
use music21_rs::tree::{Flatten, as_timespans};

let line = from_tiny_notation("4/4 c2 e4 g")?;
let tree = as_timespans(&line, Flatten::Flat, None);
let third = tree.verticality_at(3.0);
assert_eq!(third.start_timespans().len(), 1);
assert_eq!(tree.maximum_overlap(), Some(3));

Structs§

ElementTimespan
One element of a stream, from where it starts to where it ends: music21’s ElementTimespan, and its PitchedTimespan where the element is a note-like one or a stream.
Horizontality
One part’s timespans one after another: music21’s Horizontality.
TimespanTree
The timespans of a stream in time, each answer in music21’s order: by where they start, then where they end, then as the stream holds them: music21’s TimespanTree.
Verticality
What starts, stops and sounds across one offset of a TimespanTree: music21’s Verticality.

Enums§

Flatten
How as_timespans reads the streams a stream holds.

Functions§

as_timespans
Every element of a stream, nested ones included, as a timespan: music21’s asTimespans. filter keeps only the elements it accepts, as music21’s classList does; the streams are walked into either way.
unwrap
Each part’s timespans across a run of verticalities – those sounding across or starting at the first, then those starting at the rest – part by part in the order first met: music21’s VerticalitySequence.unwrap.