So I'm currently using the python library 'SpeechRecognition' in order to get phrases in between pauses from audio received from my microphone.
However what I need is to be able to print each word out as I continuously speak. But I don't know how to do that.
I'm eventually going to get to the point where I analyze a set number of words to look for a key phrase. My plan is to use multithreading in order to analyze the code at intervals.
Here's my current code
import string
import threading
import speech_recognition as sr
from threading import Thread
# obtain audio
def voiceRecognition():
while True:
audioText = ''
r = sr.Recognizer()
with sr.Microphone() as source:
audio = r.listen(source)
try:
audioText = r.recognize_google(audio)
print(audioText)
except sr.UnknownValueError:
pass
if __name__ == '__main__':
Thread(target = voiceRecognition).start()