Hi Everyone
Hi Everyone,
I find a trip "Android Text To Speech JNI Translation" in forum. But i want to convert Speech to Text, same as "Voice Recognize" .
And then i have a few code below:
{ TForm1.TRecognitionListener }
constructor TForm1.TRecognitionListener.Create(AParent: TForm1);
begin
inherited Create;
FParent := AParent;
end;
procedure TForm1.ButtonInitSpeechClick(Sender: TObject);
var
b : Boolean;
begin
b := TJSpeechRecognizer.JavaClass.isRecognitionAvailable(SharedActivityContext);
if b then
begin
SpeechRecognizer := TJSpeechRecognizer.JavaClass.createSpeechRecognizer(SharedActivityContext);
RecListener := TRecognitionListener.Create(self);
RecognizerIntent := TJRecognizerIntent.JavaClass.getVoiceDetailsIntent(SharedActivityContext);
RecognizerIntent.putExtra(TJRecognizerIntent.JavaClass.EXTRA_LANGUAGE_MODEL, StringToJString('en-US'));
SpeechRecognizer.setRecognitionListener(RecListener);
end;
end;
That's all;
Plz tell me what reason?, And, how to fix it.
Comments
Post a Comment