Margrete RPC

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

attributetint

Absolute tick of the note from the chart start.

attributepPosition

Timing as a (bar, beat, offset) :class:Position; the read-only view of t.

attributexint

Left lane index of the note.

attributewint

Width of the note in lane units (at least 1).

attributetilint

Timeline id the note belongs to.

Functions

funcshift(self, *, t=0, x=0, w=0, h=0) -> Self

Move/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.

paramself
paramtDelta | PositionLike
= 0

Tick delta, callable, or :data:Position tuple for a position-based shift.

paramxDelta
= 0

Lane delta.

paramwDelta
= 0

Width delta.

paramhDelta
= 0

Air-height delta (for notes with height).

Returns

typing.Self
funcshifted(self, *, t=0, x=0, w=0, h=0) -> Self

Return a :meth:clone shifted by the given deltas, leaving self unchanged.

paramself
paramtDelta | PositionLike
= 0
paramxDelta
= 0
paramwDelta
= 0
paramhDelta
= 0

Returns

typing.Self
funcscale(self, factor, *, pivot=0) -> Self

Scale the note's timing about pivot by factor, in place; returns self.

paramself
paramfactorfloat
parampivotint | PositionLike
= 0

Returns

typing.Self
funcscaled(self, factor, *, pivot=0) -> Self

Return a :meth:clone scaled about pivot, leaving self unchanged.

paramself
paramfactorfloat
parampivotint | PositionLike
= 0

Returns

typing.Self
funcalign(self, interval, *, mode='round') -> Self

Snap the note's timing to a multiple of interval, in place; returns self.

paramself
paramintervalint | DivisionLike

Grid spacing in ticks, or a :data:DivisionLike resolved to ticks.

parammodeAlignMode
= 'round'

How to snap: "round" (nearest), "floor", or "ceil".

Returns

typing.Self
funcaligned(self, interval, *, mode='round') -> Self

Return a :meth:clone aligned to interval, leaving self unchanged.

paramself
paramintervalint | DivisionLike
parammodeAlignMode
= 'round'

Returns

typing.Self
funcflip(self, *, field=STANDARD_FIELD_WIDTH) -> Self

Mirror the note horizontally within field lanes, in place; returns self.

paramself
paramfieldint
= STANDARD_FIELD_WIDTH

Returns

typing.Self
funcflipped(self, *, field=STANDARD_FIELD_WIDTH) -> Self

Return a :meth:clone flipped within field, leaving self unchanged.

paramself
paramfieldint
= STANDARD_FIELD_WIDTH

Returns

typing.Self
funcclamp(self, *, left=0, right=STANDARD_FIELD_WIDTH) -> Self

Clamp the note's lane extent to [left, right), in place; returns self.

paramself
paramleftint
= 0

Inclusive left boundary lane index (default 0).

paramrightint
= STANDARD_FIELD_WIDTH

Exclusive right boundary lane index (default :data:STANDARD_FIELD_WIDTH).

Returns

typing.Self
funcclamped_w(self, *, left=0, right=STANDARD_FIELD_WIDTH) -> Self

Return a :meth:clone with the lane extent clamped, leaving self unchanged.

paramself
paramleftint
= 0
paramrightint
= STANDARD_FIELD_WIDTH

Returns

typing.Self
funcclone(self) -> Self

Return a deep copy of the note (without its server-assigned id).

paramself

Returns

typing.Self
funcvalidate(self) -> None

Check the note's geometry, raising ValueError if it is invalid.

paramself

Returns

None
functo_raw(self, *, skip_validation=False) -> RawNote

Convert the note to its :class:RawNote protobuf-tree form.

paramself
paramskip_validationbool
= False

Skip the :meth:validate check before converting.

Returns

margrete_rpc.chart.notes.raw.RawNote

On this page