Skip to main content

LyricsLine

Class

Represents a single line of Lyrics.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Index

Example

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.")
});
}
}

Extends

Properties

fullLineText

readonly fullLineText: string

The full line of lyrics represented as a single string.


offset

readonly 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

readonly 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

readonly 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

getTypeName()

static getTypeName(): TypeName<LyricsLine>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<LyricsLine>

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

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

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

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

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame