Text To Speech ( TTS )

Inherit from EasyManager.cs

using EasyCodeForVivox;

public class VivoxManager : EasyManager
{

}

Inject EasyTextToSpeech

using EasyCodeForVivox;
using UnityEngine;
using Zenject;

public class VivoxTextToSpeech : MonoBehaviour
{
    EasyTextToSpeech _textToSpeech;

    [Inject]
    private void Initialize(EasyTextToSpeech textToSpeech)
    {
        _textToSpeech = textToSpeech;
    }
}

For more information on the available Text-To-Speech options check out the Vivox Documentation

Choosing Voice Gender

This method allows you to choose male or female voice. Vivox only supports English Voices

If you're a Christian, the male voice doesn’t pronounce Jesus’s name correctly so I recommend using the female voice or you can provide your players with the option to choose

EasyManager

public void ChooseVivoxVoice()
{
    ChooseVoiceGender(VoiceGender.female, "userName");
}

EasyTextToSpeech

public void ChooseVivoxVoice()
{
    _textToSpeech.ChooseVoiceGender(VoiceGender.female, "userName");
}

Local Text-to-Speech (TTS)

Local

Speak TTS Messages Locally. Messages will play over each other

Parameters Include:

  • string message = Message to Speak

  • string userName = Username of player

  • TTSDestination = Refer to Vivox Documentation

EasyManager

public void TTSMsgLocalPlayOverCurrent()
{
    PlayTTSMessage("my message to play", "userName", TTSDestination.LocalPlayback);
}

EasyTextToSpeech

public void TTSMsgLocalPlayOverCurrent()
{
    _textToSpeech.PlayTTSMessage("my message to play", TTSDestination.LocalPlayback, EasySession.LoginSessions["userName"]);
}

Local Queued

Speak TTS Messages Locally. Messages will be added to a queue and played in order recieved

Parameters Include:

  • string message = Message to Speak

  • string userName = Username of player

  • TTSDestination = Refer to Vivox Documentation

EasyManager

public void TTSMsgQueueLocal()
{
    _textToSpeech.PlayTTSMessage("my message to play", TTSDestination.QueuedLocalPlayback, EasySession.LoginSessions["userName"]);
}

EasyTextToSpeech

public void TTSMsgQueueRemoteLocal()
{
    PlayTTSMessage("my message to play",  "userName", TTSDestination.QueuedRemoteTransmissionWithLocalPlayback);
}

Local Screen Reader

Speak TTS Messages Locally. Messages will replace each other

Parameters Include:

  • string message = Message to Speak

  • string userName = Username of player

  • TTSDestination = Refer to Vivox Documentation

EasyManager

public void TTSMsgLocalReplaceCurrentMessagePlaying()
{
    PlayTTSMessage("my message to play",  "userName", TTSDestination.ScreenReader);
}

EasyTextToSpeech

public void TTSMsgLocalReplaceCurrentMessagePlaying()
{
    _textToSpeech.PlayTTSMessage("my message to play", TTSDestination.ScreenReader, EasySession.LoginSessions["userName"]);
}

Remote Text-to-Speech (TTS)

Remote

Speak TTS Messages Remotely. Messages will play over each other

Parameters Include:

  • string message = Message to Speak

  • string userName = Username of player

  • TTSDestination = Refer to Vivox Documentation

EasyManager

public void TTSMsgRemotePlayOverCurrent()
{
    PlayTTSMessage("my message to play",  "userName", TTSDestination.RemoteTransmission);
}

EasyTextToSpeech

public void TTSMsgRemotePlayOverCurrent()
{
    _textToSpeech.PlayTTSMessage("my message to play", TTSDestination.RemoteTransmission, EasySession.LoginSessions["userName"]);
}

Remote Queued

Speak TTS Messages Remotely. Messages will be added to a queue and played in order received

Parameters Include:

  • string message = Message to Speak

  • string userName = Username of player

  • TTSDestination = Refer to Vivox Documentation

EasyManager

public void TTSMsgQueueRemote()
{
    PlayTTSMessage("my message to play",  "userName", TTSDestination.QueuedRemoteTransmission);
}

EasyTextToSpeech

public void TTSMsgQueueRemote()
{
    _textToSpeech.PlayTTSMessage("my message to play", TTSDestination.QueuedRemoteTransmission, EasySession.LoginSessions["userName"]);
}

Remote and Local Text-to-Speech (TTS)

Remote and Local

Speak TTS Messages Remotely and Locally. Messages will play over each other

Parameters Include:

  • string message = Message to Speak

  • string userName = Username of player

  • TTSDestination = Refer to Vivox Documentation

EasyManager

public void TTSMsgLocalRemotePlayOverCurrent()
{
    PlayTTSMessage("my message to play",  "userName", TTSDestination.RemoteTransmissionWithLocalPlayback);
}

EasyTextToSpeech

public void TTSMsgLocalRemotePlayOverCurrent()
{
    _textToSpeech.PlayTTSMessage("my message to play", TTSDestination.RemoteTransmissionWithLocalPlayback, EasySession.LoginSessions["userName"]);
}

Remote and Local Queued

Speak TTS Messages Remotely and Locally. Messages will be added to a queue and played in order received

Parameters Include:

  • string message = Message to Speak

  • string userName = Username of player

  • TTSDestination = Refer to Vivox Documentation

EasyManager

public void TTSMsgQueueRemoteLocal()
{
    PlayTTSMessage("my message to play",  "userName", TTSDestination.QueuedRemoteTransmissionWithLocalPlayback);
}

EasyTextToSpeech

public void TTSMsgQueueRemoteLocal()
{
    _textToSpeech.PlayTTSMessage("my message to play", TTSDestination.QueuedRemoteTransmissionWithLocalPlayback, EasySession.LoginSessions["userName"]);
}

Last updated