Open saurav935 opened 1 year ago
I also have the problem, I want to let the program can recognize the speaker have spoked one sentence, then let the program goes on to recognize part. But I don't know how to solve it. I can just use 'phrase_time_limit' to let the program recognize every 15 seconds.BTW, maybe you can have a look at this one:
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("请开始说话...")
try:
audio = r.listen(source, timeout=5, phrase_time_limit=15)
except sr.WaitTimeoutError:
print("等待超时,没有检测到音频输入")
else:
print('正在转录')
text = r.recognize_google(audio, language="zh-CN") # 将"zh-CN"替换为您的语言和地区
print("您说的是:" + text)
This can work every 15 seconds.
Hi, I am trying out the below code:
I want it to function in realtime, like whenever I say something it should convert it to text but it isn't happening. Can I get some help please?