【教程】极简Python接入免费语音识别API

转载请注明出处:小锋学长生活大爆炸[xfxuezhagn.cn]

如果本文帮助到了你,请不吝给个[点赞、收藏、关注]哦~

安装库:

bash 复制代码
pip install SpeechRecognition

使用方法:

python 复制代码
import speech_recognition as sr

r = sr.Recognizer()
harvard = sr.AudioFile('harvard.wav')
with harvard as source:
    r.adjust_for_ambient_noise(source, duration=0.5)
    audio = r.record(source)

text = r.recognize_google(audio, language='zh-cn')
print(text)

完整教程可参考:

The Ultimate Guide To Speech Recognition With Python -- Real PythonAn in-depth tutorial on speech recognition with Python. Learn which speech recognition library gives the best results and build a full-featured "Guess The Word" game with it.https://realpython.com/python-speech-recognition/

相关推荐
黎雁·泠崖3 分钟前
Java底层探秘入门:从源码到字节码!方法调用的中间形态全解析
java·开发语言
千里马-horse4 分钟前
TypedArrayOf
开发语言·javascript·c++·node.js·napi
we1less9 分钟前
[audio] AudioTrack (六) 共享内存使用分析
java·开发语言
CYTElena10 分钟前
关于JAVA异常的笔记
java·开发语言·笔记·语言基础
陳103011 分钟前
C++:vector(2)
开发语言·c++
代码游侠12 分钟前
学习笔记——HTML网页开发基础
运维·服务器·开发语言·笔记·学习·html
larance14 分钟前
jupyter 服务端扩展开发
ide·python·jupyter
代码游侠17 分钟前
应用——基于C语言实现的简易Web服务器开发
运维·服务器·c语言·开发语言·笔记·测试工具
.似水22 分钟前
Python Socket
开发语言·python
码农水水24 分钟前
京东Java面试被问:系统限流的实现方式
java·开发语言·面试