Text-to-speech voice options

Before you inject a text-to-speech (TTS) message or read text locally, you can choose the voice to use for synthesizing speech. You can set this option per user at any time.

Two voices are available: male and female. You can list all available voices by using the following script:

for (auto& Elem : MyLoginSession->TTS().GetAvailableVoices())
    { UE_LOG(LogTemp, Log, TEXT("Available Voice: Name=[%s]"), *Elem.Key); }
// Available Voice: Name=[en_US male]
// Available Voice: Name=[en_US female]

ITTSVoice *NewVoice = MyLoginSession->TTS().GetAvailableVoices()["en_US female"];
if (NewVoice != nullptr)
    { MyLoginSession->TTS().SetCurrentVoice(*NewVoice); }
UE_LOG(LogTemp, Log, TEXT("Current Voice: %s"), *MyLoginSession->TTS().GetCurrentVoice().Name());
// Current Voice: en_US female

When a TTS method is called which calls for speech to be synthesized, the system uses the ITTSVoice that is set as the current voice for that user. If no voice is selected, the system uses the Vivox SDK default.