TsgcTextToSpeechAmazonMethods › TextToSpeech

TextToSpeech Method

Sends the text to Amazon Polly and stores the synthesized audio in AmazonOptions.FileName.

Syntax

procedure TextToSpeech(const aText: string);

Parameters

NameTypeDescription
aTextconst stringText to be converted to speech. Interpreted as plain text or SSML depending on AmazonOptions.TextType.

Remarks

Builds a Polly synthesize request using the values configured in AmazonOptions, signs it with the AWS credentials, writes the returned audio to AmazonOptions.FileName and - if an AudioPlayer is assigned - plays the file. The generated file is deleted after playback so that each call starts from a clean state.

Example

oTTS.AmazonOptions.VoiceId := 'Joanna';
oTTS.AmazonOptions.FileName := 'out.mp3';
oTTS.TextToSpeech('The quick brown fox jumps over the lazy dog.');

Back to Methods