Skip to main content

LyricsSync

Class

Represents a single sync/word of a LyricsLine.

  • 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.onWordStart.add(sync => {
print("Sync started: " + sync.text);
});

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

Extends

Properties

duration

readonly duration: number

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

Since

Lens Scripting Version 298


offset

readonly 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

readonly 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

readonly 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

getTypeName()

static getTypeName(): TypeName<LyricsSync>

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<LyricsSync>

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