Text to Speech (Amazon)
TsgcTextToSpeechAmazon synthesises speech with Amazon Polly. AWS requests are signed for you, the engine, voice and output format are properties, and the resulting audio plays through the audio player you assign.
TsgcTextToSpeechAmazon synthesises speech with Amazon Polly. AWS requests are signed for you, the engine, voice and output format are properties, and the resulting audio plays through the audio player you assign.
An Amazon Polly backend. Fill in the AWS credentials and region, choose an engine and a voice, and call one method.
TsgcTextToSpeechAmazon
Amazon Polly speech synthesis
Win32 and Win64
sgcAI is self-contained. This component ships inside sgcAI together with the sgcWebSockets Core runtime it is built on, so there is no base license to buy.
Set the AWS credentials and region, pick an engine and voice, link an audio player.
uses
sgcAI, sgcAI_TextToSpeech_Amazon, sgcAI_AudioPlayer_MCI;
var
oTTS: TsgcTextToSpeechAmazon;
begin
oTTS := TsgcTextToSpeechAmazon.Create(nil);
oTTS.AudioPlayer := sgcAudioPlayerMCI1;
oTTS.AmazonOptions.AWSOptions.AccessKey := 'AKIA...';
oTTS.AmazonOptions.AWSOptions.SecretKey := '...';
oTTS.AmazonOptions.AWSOptions.Region := 'eu-west-1';
oTTS.AmazonOptions.Engine := 'neural';
oTTS.AmazonOptions.VoiceId := 'Joanna';
oTTS.AmazonOptions.OutputFormat := 'mp3';
oTTS.AmazonOptions.FileName := 'speech.mp3';
oTTS.TextToSpeech('The order has been shipped.');
end;
// includes: sgcAI.hpp, sgcAI_TextToSpeech_Amazon.hpp
TsgcTextToSpeechAmazon *oTTS = new TsgcTextToSpeechAmazon(NULL);
oTTS->AudioPlayer = sgcAudioPlayerMCI1;
oTTS->AmazonOptions->AWSOptions->AccessKey = "AKIA...";
oTTS->AmazonOptions->AWSOptions->SecretKey = "...";
oTTS->AmazonOptions->AWSOptions->Region = "eu-west-1";
oTTS->AmazonOptions->VoiceId = "Joanna";
oTTS->TextToSpeech("The order has been shipped.");
The members you reach for most often.
AWSOptions carries the access key, secret key and region. Engine, VoiceId, OutputFormat, TextType and FileName shape the synthesis request.
Requests are signed with AWS Signature Version 4 by the same AWS client stack the other Amazon components use, so no separate SDK or CLI is involved.
TextType switches between plain text and SSML, which is how you control pauses, emphasis and pronunciation inside the spoken output.
AudioPlayer plays the file Polly returns. Assign a TsgcAudioPlayerMCI and playback begins as soon as the response is written.
When Polly returns an error document instead of audio the temporary file is removed and an exception is raised carrying the service error text, so a bad voice id or region fails loudly.
The same interface as the system and Google speech components, so any of them can be assigned to the chatbot, translator or assistant.
Authoritative sources for the services and protocols this component uses.
| Online HelpFull API reference and usage guide for the sgcAI components. | Open | |
| All sgcAI ComponentsBrowse the full feature matrix of all 15 components. | Open | |
| Download Free TrialSynthesise speech with your own AWS account. | Open | |
| PricingSingle, Team and Site licenses, full source code, no base product required. | Open |