QuickStart
Forneça as credenciais da conta de serviço, escolha uma voz e vincule um player de áudio.
uses
sgcAI, sgcAI_TextToSpeech_Google, sgcAI_AudioPlayer_MCI;
var
oTTS: TsgcTextToSpeechGoogle;
begin
oTTS := TsgcTextToSpeechGoogle.Create(nil);
oTTS.AudioPlayer := sgcAudioPlayerMCI1;
oTTS.GoogleOptions.Settings.LoadFromFile('service-account.json');
oTTS.GoogleOptions.Language := 'en-US';
oTTS.GoogleOptions.VoiceId := 'en-US-Neural2-C';
oTTS.GoogleOptions.AudioEncoding := 'MP3';
oTTS.GoogleOptions.FileName := 'speech.mp3';
oTTS.TextToSpeech('The order has been shipped.');
end;
TsgcTextToSpeechGoogle *oTTS = new TsgcTextToSpeechGoogle(NULL);
oTTS->AudioPlayer = sgcAudioPlayerMCI1;
oTTS->GoogleOptions->Settings->LoadFromFile("service-account.json");
oTTS->GoogleOptions->Language = "en-US";
oTTS->GoogleOptions->VoiceId = "en-US-Neural2-C";
oTTS->TextToSpeech("The order has been shipped.");