Python Forum
STT: recognition connection failed: [Errno 32] Broken pipe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
STT: recognition connection failed: [Errno 32] Broken pipe
Hi All.

I keep getting these broken pipe messages. Some STT conversions work, others don't. So the code basically works.

I imagine that there's a stretch of speech which the speech_recognition doesn't like, so it dumps the whole process with a Broken Pipe.

Can you please help me find some ideas for a work-around:
- How can I identify these parts which the speech_recognition doesn't like? And, say, print "xxxx" wherever there is a section which cannot be converted to text? Or,
- Can you explain how I can maybe "clean" the speech-input-file?

If you need my input audio_file, I will gladly post it.

Look forward to your replies.

This command works, generating good output:
Quote:rm transcript.txt; python ${stt}/ ${stt}/Joanne_davilla_35seconds.wav >> transcript.txt

This command fails:
Quote:rm transcript.txt; python ${stt}/ transcript.wav >> transcript.txt

This is the error output:
Could not request results from google Speech Recognition service; recognition connection failed: [Errno 32] Broken pipe

This is the code:
import speech_recognition as sr
import sys
from pydub import AudioSegment

# read WAV filename from arguments
audio_file = sys.argv[1]

def readAudioFile(audio_file):
    r = sr.Recognizer()
    file = sr.AudioFile(audio_file)
    with file as source:
        audio = r.record(source)
        message = r.recognize_google(audio)
        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))
    except IOError as e: 
        print("IOError; {0}".format(e))
# parser = argparse.ArgumentParser()
# parser.add_argument("--file", "-f", type=str, required=True)
# args = parser.parse_args()
# audio_file = args.file

Possibly Related Threads…
Thread Author Replies Views Last Post
  Serial connection connection issue Joni_Engr 15 661 Aug-30-2021, 04:46 PM
Last Post: deanhystad
  BrokenPipeError: [Errno 32] Broken pipe throwaway34 6 984 May-06-2021, 05:39 AM
Last Post: throwaway34
  Duplex Named Pipe with Python Server and C# Clients raybowman 1 598 Dec-03-2020, 09:58 PM
Last Post: Gribouillis
  Python broken if moved to a different folder ecastrotns 3 647 Oct-26-2020, 10:53 PM
Last Post: ecastrotns
  [Errno 54] Connection reset by peer BlueBlue 0 1,618 Oct-14-2020, 09:34 PM
Last Post: BlueBlue
  2 or more processes on the write end of the same pipe Skaperen 4 1,012 Sep-27-2020, 06:41 PM
Last Post: Skaperen
  multiprocessing Pipe.poll very slow seandepagnier 0 984 Mar-09-2020, 03:10 AM
Last Post: seandepagnier
  program will not run, errno 11001: getaddrinfo failed idioticWixen 2 1,342 Feb-29-2020, 03:14 AM
Last Post: idioticWixen
  Python DateTime is broken 10OctNotOct10a1 8 1,969 Jan-03-2020, 07:54 AM
Last Post: snippsat
  Broken interpreter? fcktheworld587 1 888 Dec-26-2019, 08:29 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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