Lens Scripting API

    Provides a map of what phoneme is said at what time in the synthesized speech.

    //@input Asset.TextToSpeechModule ttsModule

    var onTTSComplete = function(audioTrackAsset, wordInfos, phonemeInfos) {
    for (var i = 0; i < wordInfos.length; i++) {
    print("word" + wordInfos[i].word);
    print("startTime" + wordInfos[i].startTime.toString());
    print("endTime" + wordInfos[i].endTime.toString());
    }
    for (var j = 0; j < phonemeInfos.length; j++) {
    print("phoneme" + phonemeInfos[j].phoneme);
    print("startTime" + phonemeInfos[j].startTime.toString());
    print("endTime" + phonemeInfos[j].endTime.toString());
    }
    print(audioTrackAsset);
    audioComponent = script.getSceneObject().createComponent('Component.AudioComponent');
    audioComponent.audioTrack = audioTrackAsset;
    audioComponent.play(1);
    }

    var onTTSError = function(error, description) {
    print(error);
    print(description);
    }

    var options = TextToSpeech.TextToSpeechOptions.create();
    options.languageCode = "en_US";
    options.voiceName = TextToSpeech.VoiceNames.Sasha;
    options.voiceStyle = TextToSpeech.VoiceStyles.One;
    options.voicePace = 75;

    script.ttsModule.synthesize("show me you love dogs, without telling me you love dogs",
    options, onTTSComplete, onTTSError)

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    endTime: number

    Phoneme end time in milliseconds.

    isAbusive: boolean

    Is the phonemes part of an abusive word.

    phoneme: string

    The phoneme found for the alloted time.

    startTime: number

    Phoneme start time in milliseconds.

    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