biemster / gasr

Google Chrome SODA Offline Speech Recognition command line client
https://hackaday.io/project/164399-android-offline-speech-recognition-natively-on-pc
150 stars 18 forks source link

Session gets cancelled even after patching libsoda.so #13

Closed FaintWhisper closed 2 years ago

FaintWhisper commented 2 years ago

Hello!

First of all, thank you very much for all your work. I have been following this project for a long time but just found the time to patch the libsoda.so file in order to be usable. I have followed the advice provided in other issues but am struggling to get this to work.

I have initialized the variable that holds the results of the four checks to true instead of false. image

I have replaced the call to the first of those checks for an unconditional jump that skips all the four checks. image

I tried to transcribe a pre-recorded WAV file with the correct format (PCM, s16le) inside WSL. It works for the first chunk of audio but the session gets cancelled afterwards. image

I have tried many variations (e.g., NOPing the four checks instead of skipping them) but I always get the same result :(

I have noticed that there is a SHA1 hash calculation of the first parameter (which I guess that is the ExtendedSodaConfigMsg) before the four checks and that the result is used in a later part of the same function. This configuration contains, among other things the SODA API Key which in my case is a dummy API Key since I were unable to dump it from Google Chrome. Is this related to the session cancellation or does the error come from somewhere else?

I would be very grateful for some guidance.

anasalmahmud commented 2 years ago

have you try to generate a new python wrapper for the proto file? you can generate using this command protoc soda_api.proto --python_out=. install protoc with apt install -y protobuf-compiler ( copy the proto file from here ) and also try to add cfg_proto.simulate_realtime_testonly = True to class SodaClient() in gasr.py

FaintWhisper commented 2 years ago

Thank you very much for yout help! I followed your steps and now it works perfectly for both transcription of a WAV file and real-time transcription of the audio recorded from the microphone.

Thank you very much again :)

anasalmahmud commented 2 years ago

My Pleasure, I need some information. please check your email