Python Forum
Speech (audio file, wav) to Text - Broken pipe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Speech (audio file, wav) to Text - Broken pipe
#1
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)
Reply
#2
add except to catch broken pipe error:
except IOError as e:
Is this audio file downloadable?

Please be sure to include full error traceback, unmodified as requested by buran
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Get an FFMpeg pass to subprocess.PIPE to treat list as text file? haihal 2 2,461 Nov-21-2024, 11:48 PM
Last Post: haihal
  Pipe traceback to a C program Alexandros 0 1,195 Oct-22-2024, 12:32 PM
Last Post: Alexandros
  Media Pipe Python Interfacing with MATLAB cmcreecc 1 1,549 May-30-2024, 07:23 AM
Last Post: TrentErnser
  python Read each xlsx file and write it into csv with pipe delimiter mg24 4 5,858 Nov-09-2023, 10:56 AM
Last Post: mg24
  chua osillator to audio file sddfds 0 1,163 Jul-13-2023, 11:07 PM
Last Post: sddfds
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 2,903 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  Convert Excel file into csv with Pipe symbol.. mg24 4 3,246 Oct-18-2022, 02:59 PM
Last Post: Larz60+
  Why is copying and pasting a block now broken? WagmoreBarkless 2 2,716 May-05-2022, 05:01 AM
Last Post: WagmoreBarkless
  Why is copying and pasting a block now broken? WagmoreBarkless 1 2,229 May-04-2022, 11:40 PM
Last Post: Larz60+
  Modify values in XML file by data from text file (without parsing) Paqqno 2 4,640 Apr-13-2022, 06:02 AM
Last Post: Paqqno

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020