felixjunghans / google_speech

Flutter google spech
MIT License
68 stars 41 forks source link

Speech Recognition giving empty response #19

Closed harpavatkeerti closed 3 years ago

harpavatkeerti commented 3 years ago

Hi @felixjunghans, I really liked your work to simplify Google Speech to Text. I am facing an issue though.

I used flutter_sound to record an audio flac file on the file system. Using flutter_sound itself, I can play it back. But when I try to pass that to speech.recognize, I am receiving empty response. My config parameters are - encoding: AudioEncoding.FLAC, model: RecognitionModel.basic, enableAutomaticPunctuation: true, sampleRateHertz: 16000, languageCode: 'en-US'

Also, I tried your example code from this repo, but it also gives the same issue.

While passing the file, I tried for files both in temporary storage as well as file system.

I monitored my Google API console, it is receiving the requests and is showing no error in API response.

Any leads on how to debug this, or anything which I may be missing would be very helpful.

Expected behavior Text spoken should be returned in the form of string.

Smartphone

Thanks in advance.

felixjunghans commented 3 years ago

Hi, I'm glad you like the package. I tried to recreate your problem, but unfortunately I could not.

I used this file for testing purposes: https://github.com/felixjunghans/google_speech/blob/master/example/audio_file_example/assets/test.flac

Please check if you also set 16000 Hz when creating the flac file with Flutter_Sound. I think this could be the problem.

harpavatkeerti commented 3 years ago

Thanks for the prompt reply. I tried the fixes you mentioned but was still not able to get it working. I will try debugging, in the meanwhile if there is any update regarding using flutter_sound with google_speech as mentioned in one of the other issues, I would be very grateful.

sveinbjornt commented 3 years ago

This is GPL'd code, but at least should give some idea of how to use flutter_sound with the plugin:

https://github.com/mideind/Embla_Flutter/blob/main/lib/speech2text.dart

ajinkya446 commented 2 years ago

Hi @felixjunghans getting same issue while getting response from the speechrecognition. Also i had tried with other devices as well it is giving me the same issue. Could you please help us to get rid of this issue.