zaf / asterisk-speech-recog

Speech recognition script for Asterisk that uses google's speech engine.
GNU General Public License v2.0
245 stars 131 forks source link

Cloud Speech API BETA #28

Closed poing closed 7 years ago

poing commented 7 years ago

Has any work been done towards using the NEW Cloud Speech API? https://cloud.google.com/speech/

I didn't have any luck with changing the host: https://speech.googleapis.com/v1beta1/speech:syncrecognize

zaf commented 7 years ago

I didn't find any time to work on this yet.

poing commented 7 years ago

I did some testing with the Google python samples. Successfully passing µ-law files via CLI.

--- speech_rest.py  (revision 816)
+++ speech_rest.py  (working copy)
@@ -62,8 +62,8 @@
             'config': {
                 # There are a bunch of config options you can specify. See
                 # https://goo.gl/EPjAup for the full list.
-                'encoding': 'LINEAR16',  # raw 16-bit signed LE samples
-                'sampleRate': 16000,  # 16 khz            
+                'encoding': 'MULAW',  # G.711 PCMU/mu-law
+                'sampleRate': 8000,  # 8 khz           

export GOOGLE_APPLICATION_CREDENTIALS=/google_speech_api.json python speech_rest.py /var/lib/asterisk/sounds/en/hello.ulaw

{"results": [{"alternatives": [{"confidence": 0.97280418999999996, "transcript": "hello"}]}]}

It's a step closer to working AGI script. But have not had much time to work on it either.

poing commented 7 years ago

Uploaded working code, written in python. Do with it as you like.

jaylabade commented 7 years ago

Hi,

Can you please provide code for PHP/Python