#🔒 Python speech speed

6 messages · Page 1 of 1 (latest)

scenic mortar
#

Does anyone know how to make this speech to text faster. It takes like 7 seconds for it to read what I say. My wifi has also been pretty slow but I dont think its that.
import pyttsx3
import speech_recognition as sr

Python program to translate

speech to text and text to speech

Initialize the recognizer

r = sr.Recognizer()

Loop infinitely for user to

speak

while(1):

# Exception handling to handle
# exceptions at the runtime
try:
    
    # use the microphone as source for input.
    with sr.Microphone() as source2:
        
        # wait for a second to let the recognizer
        # adjust the energy threshold based on
        # the surrounding noise level 
        r.adjust_for_ambient_noise(source2, duration=0.2)
        
        #listens for the user's input 
        audio2 = r.listen(source2)
        
        # Using google to recognize audio
        MyText = r.recognize_google(audio2)
        MyText = MyText.lower()

        print("MyText: ",MyText)
        
except sr.RequestError as e:
    print("Could not request results; {0}".format(e))
    
except sr.UnknownValueError:
    print("unknown error occurred")
granite lionBOT
#

@scenic mortar

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

north plinth
#

if you have a GPU, OpenAI's Whisper is probably your best option.

granite lionBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.