NoteRegion

interface NoteRegion extends LoopableRegion, NoteEventOwner { uuid: string position: number duration: number complete: number mute: boolean label: string hue: number loopDuration: number loopOffset: number events: readonly NoteEvent[] track: NoteTrack remove(): void addEvent(props?: NoteEventProps): NoteEvent addEvents(events: readonly Partial<Pick<NoteEvent, 'pitch' | 'position' | 'duration' | 'velocity' | 'cents' | 'playCount' | 'playCurve' | 'chance'>>[]): readonly NoteEvent[] clearEvents(): void }

Region holding notes

Hierarchy


Properties

uuid: string

readonly

Inherited from uuid

Unique id

position: number

Inherited from position

Start position in PPQN

duration: number

Inherited from duration

Length in PPQN (seconds for non-synced audio regions)

complete: number

readonly

Inherited from complete

End position (position + duration)

mute: boolean

Inherited from mute

Mute the region

label: string

Inherited from label

Custom label

hue: number

Inherited from hue

Color hue (0 to 360)

loopDuration: number

Inherited from loopDuration

Loop cycle length in PPQN (seconds for non-synced audio regions)

loopOffset: number

Inherited from loopOffset

Loop start offset in PPQN (seconds for non-synced audio regions)

events: readonly NoteEvent[]

readonly

Inherited from events

All notes sorted by position

track: NoteTrack

readonly

The note track this region belongs to

Methods

remove(): void

Inherited from remove

Remove the region

Returns

  • void

addEvent(props?: NoteEventProps): NoteEvent

Inherited from addEvent

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

Parameters

Returns

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

Inherited from addEvents

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})))

clearEvents(): void

Inherited from clearEvents

Remove all notes

Returns

  • void