EZ Web Audio / createSequence
Function: createSequence()
createSequence(
transport,options):Sequence
Defined in: packages/core/src/index.ts:1018
Create a Sequence that schedules arbitrary callbacks at musical time positions.
Sequences are tied to a Transport at creation and follow its lifecycle. Events are stored as beat positions, so live BPM changes automatically affect subsequent scheduling without re-scheduling.
Parameters
transport
The Transport to sync to
options
Sequence configuration (length, loop, initial events)
Returns
Sequence instance
Example
typescript
import { createTransport, createSequence, createSound } from 'ez-web-audio'
const transport = await createTransport({ bpm: 120, timeSignature: [4, 4] })
const kick = await createSound('kick.mp3')
const seq = createSequence(transport, { length: '1m' })
seq.at('1:1:0', (time) => kick.playIn(time - ctx.currentTime))
seq.at('1:3:0', (time) => kick.playIn(time - ctx.currentTime))
transport.start()
// Change BPM — events adjust automatically
transport.bpm = 140