TsgcAIOpenAITranslatorProperties › TextToSpeech

TextToSpeech Property

Optional text-to-speech component that speaks aloud the translation returned by the OpenAI API.

Syntax

property TextToSpeech: TsgcTextToSpeech read FTextToSpeech write SetTextToSpeech;

Default Value

Remarks

Assign any TsgcTextToSpeech descendant — TsgcTextToSpeechSystem for Windows SAPI, TsgcTextToSpeechGoogle for Google Cloud TTS, or TsgcTextToSpeechAmazon for Amazon Polly — to have the translation played back automatically after OnTranslation fires with Accept = True. When the text-to-speech engine finishes playing, and the assigned recorder is running in automatic mode, the translator restarts recording so continuous conversations are possible. Leave the property unassigned when you only need the translated text; in that case the component simply invokes Start again to begin the next capture.

Example

sgcTextToSpeech := TsgcTextToSpeechSystem.Create(nil);
sgcTranslator.TextToSpeech := sgcTextToSpeech;

Back to Properties