Skip to main content

scheduleSong

@zylem/game-lib


@zylem/game-lib / audio / scheduleSong

Function: scheduleSong()

scheduleSong(song, options?): SongSchedule

Defined in: packages/game-lib/src/lib/audio/song-math.ts:111

Flattens a song into absolute note and audio events in seconds. Notes are clipped to their clip's length and to the song end; audio clips are clipped to the song end.

Parameters​

song​

bpm​

number = ...

clips​

(\{ id: string; kind: "notes"; length: number; name?: string; notes: object[]; start: number; trackId: string; \} | \{ gain?: number; id: string; kind: "audio"; length: number; name?: string; offset?: number; start: number; trackId: string; url: string; \})[] = ...

id​

string = ...

instruments​

object[] = ...

lengthBars​

number = ...

loop?​

\{ enabled: boolean; end: number; start: number; \} = ...

loop.enabled​

boolean = ...

loop.end​

number = ...

loop.start​

number = ...

Beats.

masterVolume?​

number = ...

Master fader in dB.

name​

string = ...

timeSignature​

\{ denominator: number; numerator: number; \} = TimeSignatureSchema

timeSignature.denominator​

number = ...

timeSignature.numerator​

number = ...

tracks​

object[] = ...

options?​

ScheduleOptions = \{\}

Returns​

SongSchedule