pub struct PianoRoll {
pub items: Vec<TimedNote>,
pub lanes: Vec<PianoRollLane>,
pub time: TimeGrid,
}Expand description
A piano roll: a set of timed lanes over a shared timing grid.
Holds the note projection in items alongside the full lanes, all keyed
to a single TimeGrid.
Fields§
§items: Vec<TimedNote>Note projection across all lanes, in stable order.
lanes: Vec<PianoRollLane>Lanes making up the roll, sorted by id then kind.
time: TimeGridTiming grid shared by every lane.
Implementations§
Source§impl PianoRoll
impl PianoRoll
Sourcepub fn new(items: Vec<TimedNote>) -> Result<Self, MusicError>
pub fn new(items: Vec<TimedNote>) -> Result<Self, MusicError>
Builds a roll from notes, placing them on a single note lane.
Uses the default TimeGrid; an empty input yields a roll with no lanes.
Sourcepub fn from_lanes(lanes: Vec<PianoRollLane>) -> Result<Self, MusicError>
pub fn from_lanes(lanes: Vec<PianoRollLane>) -> Result<Self, MusicError>
Builds a roll from prepared lanes using the default TimeGrid.
Sourcepub fn from_lanes_with_time(
lanes: Vec<PianoRollLane>,
time: TimeGrid,
) -> Result<Self, MusicError>
pub fn from_lanes_with_time( lanes: Vec<PianoRollLane>, time: TimeGrid, ) -> Result<Self, MusicError>
Builds a roll from prepared lanes over an explicit timing grid.
Validates time, sorts the lanes, and derives the note projection in
stable order.
Sourcepub fn from_note_events(events: Vec<NoteEvent>) -> Result<Self, MusicError>
pub fn from_note_events(events: Vec<NoteEvent>) -> Result<Self, MusicError>
Builds a roll from note events on a single performance note lane.
Converts each event’s tick timing to grid time with normal articulation.
Sourcepub fn from_performance_take(take: &PerformanceTake) -> KernelResult<Self>
pub fn from_performance_take(take: &PerformanceTake) -> KernelResult<Self>
Builds a roll from a performance take’s extracted note events.
Surfaces extraction or validation failures as a kernel evaluation error.
Sourcepub fn cells(&self) -> impl Iterator<Item = &PianoRollCell>
pub fn cells(&self) -> impl Iterator<Item = &PianoRollCell>
Iterates over every cell across all lanes.
Sourcepub fn note_slices(&self) -> Vec<NoteSlice>
pub fn note_slices(&self) -> Vec<NoteSlice>
Splits the roll at every note onset and release into exact sounding windows.
Silent spans and zero-duration notes do not produce slices. Equal
pitches in different cells remain separate SlicedNote entries.