Forums

Speech (audio file, wav) to Text - Broken pipe

I am trying to read a wav file of size 24.4MB, 9 mins 33 secs. using a simple python speech_recogniton code, i am getting below mentioned error. any suggestions would be great help.

Error: Could not request results from google Speech Recognition service; recognition connection failed: [Errno 32] Broken pipe

def readAudioFile(audio_file): r = sr.Recognizer() file = sr.AudioFile(audio_file) with file as source:

audio = r.record(source) type(audio) try: message = r.recognize_google(audio) print(message) print("Data extracted from phone conversation:\n" + message) except sr.UnknownValueError: print("Google Speech Recognition could not understand audio") except sr.RequestError as e: print("Could not request results from google Speech Recognition service; {0}".format(e))

parser = argparse.ArgumentParser() parser.add_argument("--file", "-f", type=str, required=True) args = parser.parse_args() audio_file = args.file print(audio_file) readAudioFile(audio_file)

It sounds like the app is trying to connect to some sort of Google service to do the speech recognition and that is being blocked because it's not using the proxy. See http://help.pythonanywhere.com/pages/403ForbiddenError/ for more details. You will need to configure the library you're using to go through the proxy and we may also need to add the API to the whitelist.