Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.4k stars 2.4k forks source link

Could not recognize audio #376

Open anil2496 opened 6 years ago

anil2496 commented 6 years ago

import speech_recognition as sr r = sr.Recognizer() harvard = sr.AudioFile('jackhammer.wav') with harvard as source: r.adjust_for_ambient_noise(source) audio = r.record(source) type(audio) print(r.recognize_google(audio))

showning error:

File "/home/anil/.local/lib/python2.7/site-packages/speech_recognition/init.py", line 844, in recognize_google raise RequestError("recognition connection failed: {}".format(e.reason)) speech_recognition.RequestError: recognition connection failed: [Errno -2] Name or service not known

palikar commented 6 years ago

It seems that the call to the Google Speech API is failing. I hope you know that r.recognize_google(audio) uses a API from Google that is only for Chromium developers (or at least for people that are in the google group). You can reference the documentation for more details on the method.

Before using the Google APIs you must have set up all of their credential stuff.

partounian commented 6 years ago

I'm having issues with google cloud api not returning anything at all for certain audio files.

Example: https://drive.google.com/file/d/1XF5nQ2Nc7T6ODW0B198XrFLByRQG3fnY/view?usp=sharing