python - 我需要做什么才能检测到我的麦克风?
问题描述
我厌倦了在 python 中制作一个简单的“语音到文本”程序。正如我所见,这不是一项艰巨的任务,但我的代码不起作用。我没有收到任何错误或警告消息,程序没有在 PyCharm 中检测到我的声音。我检查了我的麦克风,它正在工作。
我的代码:
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
print("Speak Anything :")
audio = r.listen(source)
try:
text = r.recognize_google(audio)
print("You said : {}".format(text))
except:
print("Sorry could not recognize what you said")
解决方案
推荐阅读
- javascript - JavaScript 大整数平方根
- c# - 使用不是表单提交按钮的另一个按钮重置剃刀页面中的搜索条件
- c# - 在 ASP.NET 中从 SQL Server 读取数据
- c# - 如何在应用程序启动时在第一种形式的菜单栏下显示第二种形式?
- python - 用用户词典和其他人替换特定单词为0
- javascript - 当鼠标悬停在任何按钮上时执行一个函数
- r - 训练一个基本的 SVM 不产生预测
- makefile - 如何删除makefile中的子字符串
- python - Python mysql.connector - cursor.execute("WHERE .... ) 返回 NoneType
- powershell - (400) 尝试向 API 发布简单值时出现错误请求