subsequence.pattern
The API reference for PlacedNote.
PlacedNote
class PlacedNote(
position: int,
pitch: int,
origin: typing.Optional[str],
index: int,
velocity: int,
duration: typing.Optional[int],
primary_unmapped: bool = False,
)
One note read back off a pattern being built — see PatternBuilder.placed().
A read-only copy rather than a view: a consumer diffing what a generator
added must not be able to reach through the answer and edit the pattern.
Frozen also makes it hashable, so set(after) - set(before) works.
Positions and durations are in pulses, the unit the pattern stores and
the one every grid classification already uses (PatternBuilder.thin()
documents that zone arithmetic). Handing back beats would mean a float
divide and a rounding rule that could disagree with the caller's on a note
groove has nudged; a caller wanting beats divides by a constant and loses
nothing.
duration is None for a drone, which has no end until a later
drone_off() places one.
index exists so two notes that are otherwise identical stay distinct:
nothing stops a hand-placed kick and a generated one landing on the same
pulse, and without it a set difference would report the second as already
present. It is an identity token, not a count — treat it as opaque.
Members: duration, index, origin, pitch, position, primary_unmapped, velocity
PlacedNote.position
PlacedNote.position: int
PlacedNote.pitch
PlacedNote.pitch: int
PlacedNote.origin
PlacedNote.origin: typing.Optional[str]
PlacedNote.index
PlacedNote.index: int
PlacedNote.velocity
PlacedNote.velocity: int
PlacedNote.duration
PlacedNote.duration: typing.Optional[int]
PlacedNote.primary_unmapped
PlacedNote.primary_unmapped: bool = False