Skip to content Skip to sidebar Skip to footer

Python3 Oserror: [errno -9988] Stream Closed

I'm working on voice recognition system with Raspberry pi 3B and while running some code I face some problem which is given below. I was tried so many stuffs from the internet but

Solution 1:

[Errno -9998] Invalid number of channels

I improve/clean your code:

import speech_recognition as sr
import textToVoice as tv

r = sr.Recognizer()

with sr.Microphone() as source:  # your problem was at this line.print('Say Something For Google Search')
    try:
        audio = r.listen(source)
    except Exception as e:
        print(e)
    print('Now, Processing on your request!')

try:
    text =r.recognize_google(audio)
    lang = 'en'
    tv.tts(text, lang)
    print('You Say:\n' + text)

except Exception as e:
    print('problem For Fatchning Page')
    print(e)

You can follow the steps given below for install:

sudo pip install SpeechRecognition

sudo pip install pyaudio

If you found error:

sudo apt-get install python-pyaudio

sudo apt-get install libjack-jackd2-dev portaudio19-dev

Then again:

sudo pip install pyaudio

If you found error try this:

sudo pip install --upgrade pyaudio

NOTE: Maybe this link help you up: https://stackoverflow.com/a/48460182/3702377

Post a Comment for "Python3 Oserror: [errno -9988] Stream Closed"