speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

Could not recognize audio

Open anil2496 opened this issue 7 years ago • 3 comments

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

anil2496 avatar Sep 18 '18 17:09 anil2496

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.

palikar avatar Oct 24 '18 20:10 palikar

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

partounian avatar Oct 26 '18 23:10 partounian

Hello!
I’m participating in Hacktoberfest 2025 and would like to work on issue #376.
I’m comfortable with Python and library fixes, and I’d love to help get this resolved.
Could you please assign this to me if it’s still available? Thanks!

Pranavi125 avatar Oct 29 '25 04:10 Pranavi125