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
  python Read each xlsx file and write it into csv with pipe delimiter mg24 4 1,407 Nov-09-2023, 10:56 AM
Last Post: mg24
  chua osillator to audio file sddfds 0 428 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 1,105 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  Convert Excel file into csv with Pipe symbol.. mg24 4 1,308 Oct-18-2022, 02:59 PM
Last Post: Larz60+
  Why is copying and pasting a block now broken? WagmoreBarkless 2 1,376 May-05-2022, 05:01 AM
Last Post: WagmoreBarkless
  Why is copying and pasting a block now broken? WagmoreBarkless 1 1,220 May-04-2022, 11:40 PM
Last Post: Larz60+
  Modify values in XML file by data from text file (without parsing) Paqqno 2 1,641 Apr-13-2022, 06:02 AM
Last Post: Paqqno
  Controlling text-to-speech pauses with pyttsx3 pmac1300 4 4,410 Mar-14-2022, 06:47 AM
Last Post: Coricoco_fr
  Converted Pipe Delimited text file to CSV file atomxkai 4 6,938 Feb-11-2022, 12:38 AM
Last Post: atomxkai
  Speech Recognition with timestamps DeanAseraf1 3 6,557 Jun-27-2021, 06:58 PM
Last Post: gh_ad

Forum Jump:

User Panel Messages

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