NoteEventOwner

interface NoteEventOwner { events: readonly NoteEvent[] addEvent(props?: NoteEventProps): NoteEvent addEvents(events: readonly Partial<Pick<NoteEvent, 'velocity' | 'chance' | 'pitch' | 'velocityFade' | 'position' | 'duration' | 'cents' | 'playCount' | 'playCurve' | 'repeatLength'>>[]): readonly NoteEvent[] groupEvents(events: readonly NoteEvent[], mode?: NoteGroupMode): NoteGroup clearEvents(): void }

Common surface of note regions and clips


Properties

events: readonly NoteEvent[]

readonly

All notes sorted by position

Methods

addEvent(props?: NoteEventProps): NoteEvent

Add a note (defaults: position 0, duration 1/16, pitch 60, velocity 100/127)

Parameters

Returns

addEvents( events: readonly Partial<Pick<NoteEvent, 'velocity' | 'chance' | 'pitch' | 'velocityFade' | 'position' | 'duration' | 'cents' | 'playCount' | 'playCurve' | 'repeatLength'>>[], ): readonly NoteEvent[]

Add many notes at once

Parameters

Returns

Example

CODE
region.addEvents([60, 64, 67].map((pitch, index) => ({position: index * PPQN.Quarter, duration: PPQN.Quarter, pitch})))

groupEvents( events: readonly NoteEvent[], mode?: NoteGroupMode, ): NoteGroup

Group notes of this region or clip, so they decide their chance together. Notes leave their previous group

Parameters

Returns

Example

CODE
const chord = region.addEvents([60, 64, 67].map(pitch => ({pitch, duration: PPQN.Quarter})))
region.groupEvents(chord, "play-all").chance = 50

clearEvents(): void

Remove all notes

Returns

  • void