Skip to content

API Interface MusicHandle

github-actions[bot] edited this page Nov 29, 2026 · 2 revisions

Interface: MusicHandle

Defined in: src/engine/core/musicEvents.ts:101

handle.music (§1.2): readable from M4a. Every getter is main-side state, no call to the core; the getters share one snapshot per display frame, recomputed on first read.

Properties

bar

readonly bar: number;

Defined in: src/engine/core/musicEvents.ts:104


beat

readonly beat: number;

Defined in: src/engine/core/musicEvents.ts:105


beatFraction

readonly beatFraction: number;

Defined in: src/engine/core/musicEvents.ts:106


beatsPerBar

readonly beatsPerBar: number;

Defined in: src/engine/core/musicEvents.ts:109


beatUnit

readonly beatUnit: number;

Defined in: src/engine/core/musicEvents.ts:111

The metre's note value (4 in 3/4).


segment

readonly segment: string | null;

Defined in: src/engine/core/musicEvents.ts:103

Id of the playing segment; null while priming the first one.


tempo

readonly tempo: number;

Defined in: src/engine/core/musicEvents.ts:108

Beats per minute.


time

readonly time: number;

Defined in: src/engine/core/musicEvents.ts:113

Heard time (seconds) of the position above: this display frame's Audio.time.


transition

readonly transition: 
  | {
  time: number;
  to: string;
}
  | null;

Defined in: src/engine/core/musicEvents.ts:115

The pending change, or null: target child id and the heard time (seconds) it lands.

Methods

nextGrid()

nextGrid(spec): GridPoint | null;

Defined in: src/engine/core/musicEvents.ts:120

Next grid point of that spec. For a pending change the points after transition.time are the new segment's (GridPoint.segment says which). Null when not playing.

Parameters

spec

GridSpec

Returns

GridPoint | null


positionAt()

positionAt(performanceTime): MusicPositionAt;

Defined in: src/engine/core/musicEvents.ts:122

Map an input timestamp (performance.now() ms) to the music (M4c); segment is null when not playing at that instant.

Parameters

performanceTime

number

Returns

MusicPositionAt


seek()

seek(to): MusicSeekResult;

Defined in: src/engine/core/musicEvents.ts:127

Jump to a musical position "bar:beat:tick" (§2.2) within the segment playing when the seek lands (M4b; owner decision 4; behaviour [ARCH §3.9], ruling R25).

Parameters

to

string

Returns

MusicSeekResult

Clone this wiki locally