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)