docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface ITextToSpeech

    An interface for events and methods related to text-to-speech.

    Inherited Members
    INotifyPropertyChanged.PropertyChanged
    Namespace: VivoxUnity
    Assembly: VivoxUnity.dll
    Syntax
    public interface ITextToSpeech : INotifyPropertyChanged

    Properties

    AvailableVoices

    All voices available to the text-to-speech subsystem for speech synthesis.

    Declaration
    ReadOnlyCollection<ITTSVoice> AvailableVoices { get; }
    Property Value
    Type Description
    ReadOnlyCollection<ITTSVoice>

    CurrentVoice

    The voice used by text-to-speech methods called from this ILoginSession.

    Declaration
    ITTSVoice CurrentVoice { get; set; }
    Property Value
    Type Description
    ITTSVoice
    Remarks

    If this is not set, then the SDK default voice is used. You can obtain valid ITTSVoices from AvailableVoices. When setting this, if the new voice is not available (for example, when loaded from saved settings after updating), then ObjectNotFoundException is raised.

    Messages

    Contains all text-to-speech (TTS) messages playing or waiting to be played in all destinations.

    Declaration
    ITTSMessageQueue Messages { get; }
    Property Value
    Type Description
    ITTSMessageQueue
    Remarks

    Use the ITTSMessageQueue events to get notifications of when messages are spoken or canceled, or when playback starts or ends. Methods to Enqueue(), Dequeue(), Remove(), or Clear() items directly from this collection result in the same behavior as using other class methods to Speak() or Cancel*() TTS messages in the text-to-speech subsystem.

    Methods

    CancelAll()

    Cancel all text-to-speech messages (ongoing and enqueued) from all destinations.

    Declaration
    void CancelAll()

    CancelDestination(TTSDestination)

    Cancel all text-to-speech messages in a destination (ongoing and enqueued).

    Declaration
    void CancelDestination(TTSDestination destination)
    Parameters
    Type Name Description
    TTSDestination destination

    The TTSDestination to clear of messages.

    Remarks

    The TTSDestinations QueuedRemoteTransmission and QueuedRemoteTransmissionWithLocalPlayback share a queue, but are not the same destination. Canceling all messages in one of these destinations automatically triggers the playback of the next message from the other in the shared queue.

    CancelMessage(TTSMessage)

    Cancel a single currently playing or enqueued text-to-speech message.

    Declaration
    void CancelMessage(TTSMessage message)
    Parameters
    Type Name Description
    TTSMessage message

    The TTSMessage to cancel.

    Remarks

    In destinations with queues, canceling an ongoing message automatically triggers the playback of the next message. Canceling an enqueued message shifts all later messages up one place in the queue.

    GetMessagesFromDestination(TTSDestination)

    Retrieve ongoing or enqueued TTSMessages in the specified destination.

    Declaration
    ReadOnlyCollection<TTSMessage> GetMessagesFromDestination(TTSDestination destination)
    Parameters
    Type Name Description
    TTSDestination destination

    The TTSDestination to retrieve messages for.

    Returns
    Type Description
    ReadOnlyCollection<TTSMessage>

    A queue containing the messages for a single destination.

    Remarks

    Queued destinations return their ITTSMessageQueue in queue order, and others in the order that speech was injected.

    Speak(TTSMessage)

    Inject a new text-to-speech (TTS) message into the TTS subsystem.

    Declaration
    void Speak(TTSMessage message)
    Parameters
    Type Name Description
    TTSMessage message

    A TTSMessage that contains the text to be converted into speech and the destination for TTS injection.

    Remarks

    The Voice and State properties of the message are set by this function. For information on how the ITTSVoice that is used for speech synthesis is selected, see CurrentVoice. Synthesized speech sent to remote destinations plays in connected channel sessions according to the transmission policy (the same sessions that basic voice transmits to).

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)