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
groove: Nullable<AnyGroove>
remove(): void
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
}Region holding notes
Hierarchy
Properties
uuid: string
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
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[]
Inherited from events
All notes sorted by position
track: NoteTrack
The note track this region belongs to
- See:
groove: Nullable<AnyGroove>
The groove its notes play through, running on from where its loop starts, null for none. Set a groove of the project or null.
- See:
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
props(NoteEventProps, optional)
Returns
addEvents(
events: readonly Partial<Pick<NoteEvent, 'velocity' | 'chance' | 'pitch' | 'velocityFade' | 'position' | 'duration' | 'cents' | 'playCount' | 'playCurve' | 'repeatLength'>>[],
): readonly NoteEvent[]
Inherited from addEvents
Add many notes at once
Parameters
events(readonly Partial<Pick<NoteEvent, "velocity" | "chance" | "pitch" | "velocityFade" | "position" | "duration" | "cents" | "playCount" | "playCurve" | "repeatLength">>[])
Returns
Example
region.addEvents([60, 64, 67].map((pitch, index) => ({position: index * PPQN.Quarter, duration: PPQN.Quarter, pitch})))groupEvents(
events: readonly NoteEvent[],
mode?: NoteGroupMode,
): NoteGroup
Inherited from groupEvents
Group notes of this region or clip, so they decide their chance together. Notes leave their previous group
Parameters
events(readonly NoteEvent[])mode(NoteGroupMode, optional)
Returns
Example
const chord = region.addEvents([60, 64, 67].map(pitch => ({pitch, duration: PPQN.Quarter})))
region.groupEvents(chord, "play-all").chance = 50clearEvents(): void
Inherited from clearEvents
Remove all notes
Returns
void