LyricsSync
ClassRepresents a single sync/word of a LyricsLine.
- Available on all platforms
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
readonlyduration:number
Duration (in seconds) of this sync. Equivalent to offsetEnd - offset.
Since
Lens Scripting Version 298
offset
readonlyoffset: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
readonlyoffsetEnd: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
readonlytext: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()
staticgetTypeName():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
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
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
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean