Lens Scripting API

    Class LyricsSync

    Represents a single sync/word of a LyricsLine.


    const externalMusicModule = require("LensStudio:ExternalMusicModule") as ExternalMusicModule;

    @component
    export class LyricsExample extends BaseScriptComponent {
    // Make sure an AudioTrack asset is included in the scene. It determines the track that plays.
    // If you see errors, make sure that "Bundled" is unchecked (disabled) on the AudioTrack.
    @input audioAsset: AudioTrackAsset;

    onAwake() {
    const lyricsTracker = externalMusicModule.getLyricsTracker();

    lyricsTracker.onWordStart.add(sync => {
    print("Sync started: " + sync.text);
    });

    lyricsTracker.onWordEnd.add(sync => {
    print("Sync ended: " + sync.text);
    })
    }
    }

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    duration: number

    Duration (in seconds) of this sync. Equivalent to offsetEnd - offset.

    offset: number

    Offset (in seconds) that this sync begins, relative to the start of the LyricsLine this sync is part of. Add this offset to the LyricsLine.offset to convert it to playback time, which can be compared to LyricsTracker.playbackPosition.

    offsetEnd: number

    Offset (in seconds) that this sync ends, relative to the start of the LyricsLine this sync is part of. Add this offset to the LyricsLine.offset to convert it to playback time, which can be compared to LyricsTracker.playbackPosition.

    text: string

    The text value of this sync. Depending on the LyricsType of the lyrics data, this may be a single word, whitespace, or an entire line of text.

    Methods

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    MMNEPVFCICPMFPCPTTAAATR