Represents the full set of Lyrics data for tracked music. Can be accessed through LyricsTracker.fullLyrics when lyrics are available.

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.onLyricsAvailable.add(() => {
const fullLyrics = lyricsTracker.fullLyrics;

// Iterate through all lines in the lyrics data
fullLyrics.lines.forEach(line => {

// Iterate through all syncs in the line
line.syncs.forEach(sync => {
// Calculate start time for this sync
const startTime = line.offset + sync.offset;

// Calculate end time for this sync
const endTime = line.offset + sync.offsetEnd;

// Note that these times can be compared to current playback time using lyricsTracker.playbackPosition.

// Get text for this sync
// Note: For RichSync lyrics data, each sync text will be a single word or whitespace between words.
// For LineSync lyrics data, each sync will be the full line of text.
const text = sync.text;
});
});
});
}
}

Hierarchy (View Summary, Expand)

Constructors

Properties

clipDuration: number

Duration (in seconds) of the tracked music.

lines: LyricsLine[]

Lyrics represented as a list of LyricsLine objects in the order they appear in the tracked music.

Type of the lyrics data available. Describes the granularity of timing data available for the lyrics.

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