MotionScript

@motion-script/core


@motion-script/core / audioTimelineDuration

Function: audioTimelineDuration()

audioTimelineDuration(tracks, catalog): number

Defined in: runtime/globals.ts:451

The natural length of a set of AudioTracks standing on their own: the furthest point any non-looping track reaches.

resolveGlobalAudio clips every track to a duration the caller already knows, because a project bed must never lengthen the project. A timeline made only of audio has no scenes to take that duration from, so it needs this first — resolving against a duration of 0 yields nothing at all.

A looping track contributes nothing here: it runs until the timeline ends, so it can't be what decides where the timeline ends. If every track loops the result is 0 and the caller must supply a duration of its own.

Tracks that fail to resolve (unknown src, inverted trim) are skipped — resolveGlobalAudio is where those surface as errors, and reporting them twice for one bad track would double every message.

Parameters

tracks

readonly AudioTrack[]

catalog

AssetCatalog

Returns

number