Note
The common interface implemented by every typed note.
Notes expose geometry (timing t/p, lane x, width w) and a set of
transforms. Each transform comes in two forms: the bare verb (e.g. :meth:shift)
mutates the note in place and returns self for chaining, while the past-tense form
(e.g. :meth:shifted) returns a transformed :meth:clone and leaves the original
untouched.
Attributes
attributetintAbsolute tick of the note from the chart start.
attributepPositionTiming as a (bar, beat, offset) :class:Position; the read-only view of t.
attributexintLeft lane index of the note.
attributewintWidth of the note in lane units (at least 1).
attributetilintTimeline id the note belongs to.
Functions
funcshift(self, *, t=0, x=0, w=0, h=0) -> SelfMove/resize the note in place and return self.
Each delta is either an int added to the field, or a callable mapping the current
value to a new one. Pass a :data:Position tuple for t to shift timing by a
musical position delta.
paramselfparamtDelta | PositionLike= 0Tick delta, callable, or :data:Position tuple for a position-based shift.
paramxDelta= 0Lane delta.
paramwDelta= 0Width delta.
paramhDelta= 0Air-height delta (for notes with height).
Returns
typing.Selffuncshifted(self, *, t=0, x=0, w=0, h=0) -> SelfReturn a :meth:clone shifted by the given deltas, leaving self unchanged.
paramselfparamtDelta | PositionLike= 0paramxDelta= 0paramwDelta= 0paramhDelta= 0Returns
typing.Selffuncscale(self, factor, *, pivot=0) -> SelfScale the note's timing about pivot by factor, in place; returns self.
paramselfparamfactorfloatparampivotint | PositionLike= 0Returns
typing.Selffuncscaled(self, factor, *, pivot=0) -> SelfReturn a :meth:clone scaled about pivot, leaving self unchanged.
paramselfparamfactorfloatparampivotint | PositionLike= 0Returns
typing.Selffuncalign(self, interval, *, mode='round') -> SelfSnap the note's timing to a multiple of interval, in place; returns self.
paramselfparamintervalint | DivisionLikeGrid spacing in ticks, or a :data:DivisionLike resolved to ticks.
parammodeAlignMode= 'round'How to snap: "round" (nearest), "floor", or "ceil".
Returns
typing.Selffuncaligned(self, interval, *, mode='round') -> SelfReturn a :meth:clone aligned to interval, leaving self unchanged.
paramselfparamintervalint | DivisionLikeparammodeAlignMode= 'round'Returns
typing.Selffuncflip(self, *, field=STANDARD_FIELD_WIDTH) -> SelfMirror the note horizontally within field lanes, in place; returns self.
paramselfparamfieldint= STANDARD_FIELD_WIDTHReturns
typing.Selffuncflipped(self, *, field=STANDARD_FIELD_WIDTH) -> SelfReturn a :meth:clone flipped within field, leaving self unchanged.
paramselfparamfieldint= STANDARD_FIELD_WIDTHReturns
typing.Selffuncclamp(self, *, left=0, right=STANDARD_FIELD_WIDTH) -> SelfClamp the note's lane extent to [left, right), in place; returns self.
paramselfparamleftint= 0Inclusive left boundary lane index (default 0).
paramrightint= STANDARD_FIELD_WIDTHExclusive right boundary lane index (default :data:STANDARD_FIELD_WIDTH).
Returns
typing.Selffuncclamped_w(self, *, left=0, right=STANDARD_FIELD_WIDTH) -> SelfReturn a :meth:clone with the lane extent clamped, leaving self unchanged.
paramselfparamleftint= 0paramrightint= STANDARD_FIELD_WIDTHReturns
typing.Selffuncclone(self) -> SelfReturn a deep copy of the note (without its server-assigned id).
paramselfReturns
typing.Selffuncvalidate(self) -> NoneCheck the note's geometry, raising ValueError if it is invalid.
paramselfReturns
Nonefuncto_raw(self, *, skip_validation=False) -> RawNoteConvert the note to its :class:RawNote protobuf-tree form.
paramselfparamskip_validationbool= FalseSkip the :meth:validate check before converting.
Returns
margrete_rpc.chart.notes.raw.RawNote