Lens Scripting API

    Class LyricsLine

    Represents a single line of Lyrics.

    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.onLineStart.add(line => {
    print("Line started with the text: " + line.fullLineText);

    print("Number of syncs within the line: " + line.syncs.length);
    });

    lyricsTracker.onLineEnd.add(line => {
    print("The line has ended.")
    });
    }
    }

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    fullLineText: string

    The full line of lyrics represented as a single string.

    offset: number

    Offset (in seconds) that this line begins relative to the start of the tracked music. Note that this value can be negative, since music tracks can start halfway through a line being sung. This value is useful to compare with LyricsTracker.playbackPosition.

    offsetEnd: number

    Offset (in seconds) that this line ends relative to the start of the tracked music. This value is useful to compare with LyricsTracker.playbackPosition.

    syncs: LyricsSync[]

    Lyrics for this line represented as a list of LyricsSync objects in the order they appear.

    Note that for LineSync lyrics data, only one LyricsSync object will be present in the list, representing the entire line.

    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