Sample perfect Audioworklet MIDI Scheduler Node
npm i scheduler-node
pnpm add scheduler-node
yarn add scheduler-node
# Clock
# constructor
() # buffer
 = ...
# coeff
# internalTime
# offsetFrame
# SchedulerEvent
# constructor
(data) # id
 = ...
# midiEvent
 = ...
{
# data
# receivedTime
}
# toJSON
()
toJSON () Â =>
{
# id
 = ...
# midiEvent
 = ...
{
# data
 = ...
# receivedTime
 = ...
}
}
# SchedulerEventGroup
# constructor
(eventGroup)
# new SchedulerEventGroup
()
# id
 = ...
# loopPoints
 = ...
# onRequestNotes
# (turn, total)
# turn
# total
(turn, total) Â =>
# scheduler
# targets
 = ...
# loop
# loopEnd
# loopStart
# setMidiEvents
(turnEvents, turn, clear)
# turnEvents
# turn
 = 0
# clear
setMidiEvents (turnEvents, turn, clear) Â =>
# setNotes
(turnNotes, turn, clear)
# turnNotes
# turn
 = 0
# clear
setNotes (turnNotes, turn, clear) Â =>
# toJSON
()
toJSON () Â =>
{
# id
 = ...
# loopPoints
 = ...
# targets
 = ...
}
# SchedulerEventGroupNode
# constructor
(schedulerNode)
# new SchedulerEventGroupNode
()
# eventGroup
 = ...
# onconnectchange
# schedulerNode
# targetNodes
 = ...
# clear
() # connect
(targetNode)
# targetNode
connect (targetNode) Â =>
# destroy
() # disconnect
(targetNode) # resume
(targetNode)
# targetNode
resume (targetNode) Â =>
# suspend
(targetNode)
# targetNode
suspend (targetNode) Â =>
# SchedulerNode
# constructor
(context) # context
# eventGroups
 = ...
# node
# targetNodes
 = ...
# worklet
# addEventGroup
(eventGroup) # connect
(targetNode)
# targetNode
connect (targetNode) Â =>
# disconnect
(targetNode) # removeEventGroup
(eventGroup) # requestNextEvents
(eventGroupId, turn, total)
# eventGroupId
# turn
 = 0
# total
 = 4
requestNextEvents (eventGroupId, turn, total) Â =>
# setBpm
(bpm) # setClockBuffer
(clockBuffer) # start
(playbackStartTime, offsetStartTime)
# playbackStartTime
# offsetStartTime
start (playbackStartTime, offsetStartTime) Â =>
# stop
() # create
(context)
# context
create (context) Â =>
# register
(context)
# context
register (context) Â =>
# SchedulerTarget
# constructor
(data) # id
 = ...
# midiQueue
 = ...
# SchedulerTargetNode
# constructor
(context, name, options)
# new SchedulerTargetNode
()
# id
 = ...
# schedulerTarget
 = ...
# worklet
# init
() # processMidiEvent
(midiEvent)
# SchedulerSyncedSetPayload
# LoopKind
# LoopKind
 = ...
{
# Live
 = 2
# Loop
 = 1
# Once
 = 0
}
Fork or edit and submit a PR.
All contributions are welcome!
MIT © 2023 stagas