
 JSynthesisCallback = interface; // android.speech.tts.SynthesisCallback
JSynthesisRequest = interface; // android.speech.tts.SynthesisRequest
JTextToSpeech = interface; // android.speech.tts.TextToSpeech
JTextToSpeech_Engine = interface; // android.speech.tts.TextToSpeech$Engine
JTextToSpeech_EngineInfo = interface; //android.speech.tts.TextToSpeech$EngineInfo
JTextToSpeech_OnInitListener = interface; // android.speech.tts.TextToSpeech$OnInitListener
JTextToSpeech_OnUtteranceCompletedListener = interface; // android.speech.tts.TextToSpeech$OnUtteranceCompletedListener
JTextToSpeechService = interface; // android.speech.tts.TextToSpeechService
JUtteranceProgressListener = interface; // android.speech.tts.UtteranceProgressListener
And here is a sample from the demo that is included with the wrapper:
procedure TForm1.TttsOnInitListener.onInit(status: Integer);
var
Result : Integer;
begin
if (status = TJTextToSpeech.JavaClass.SUCCESS) then
begin
result := FParent.tts.setLanguage(TJLocale.JavaClass.US);
if (result = TJTextToSpeech.JavaClass.LANG_MISSING_DATA) or
(result = TJTextToSpeech.JavaClass.LANG_NOT_SUPPORTED) then
ShowMessage('This Language is not supported')
else
begin
FParent.Button1.Enabled := true;
FParent.button2.Enabled := false;
end;
end
else
ShowMessage('Initilization Failed!');
end;
procedure TForm1.SpeakOut;
var
text : JString;
begin
text := StringToJString(Memo1.Lines.Text);
tts.speak(text, TJTextToSpeech.JavaClass.QUEUE_FLUSH, nil);
end;
Check out the blog post and download the wrapper unit.
How I can configure it in Spanish?
What I did was, I download a spanish tts to my android phone, then on “TttsOnInitListener.onInit” procedure I replace this:
result := FParent.tts.setLanguage(TJLocale.JavaClass.US);
with this
result := FParent.tts.setLanguage(TJLocale.JavaClass.getDefault);
Hi, how download the spanish language to android? and to change this line:
FParent. tts.setLanguage (TJLocale.JavaClass.getDefault); the app crash.
Speech to Text without VirtualKeyboard button?
Not sure what you mean?
It does not work on the Galaxy . (TTS INIT ERROR)
What is the reason ?
my phone: Samsung GalaxyNote-2 (Jellybin 4.3)
First of all, thank you for this example.
On my Samsung S3 (Android 4.3) example doesn’t work.
Program crashes on
tts := TJTextToSpeech.JavaClass.init(SharedActivityContext, ttsListener);
Prior to upgrade of Android version everything was working fine. On another device (Android 4.0.4) there is no problem.
I noticed that there were some changes in API level 18 for TTS. Maybe that’s the reason?
Best regards,
Found this example:
http://www.winsoft.sk/atts.htm