I was wondering whether there is a way to output words as soon as possible. For example if I say "hello world" it should output:
hello
world
Currently I'm using this code
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
while True:
r.pause_threshold=0.1 ##i tried playing with these 3 but no luck
r.phrase_threshold=0.5
r.non_speaking_duration=0.1
audio = r.listen(source)
try:
text = r.recognize_google(audio)
print(text)
except Exception as e:
print("-")
What this does is that it records until the mic doesn't hear anything and then outputs everything that it heard in one line, I want to see what has been said as quickly as possible.