赞
踩
第一步,pip下载模块
第二部,把mp3格式转成wav格式。
注意:不稳定
import speech_recognition as sr # 创建一个Recognizer实例 r = sr.Recognizer() # 读取音频文件 audio_file = sr.AudioFile('./ddd.wav') # 从音频文件中读取音频 with audio_file as source: audio_data = r.record(source) # 识别语音 text = r.recognize_google(audio_data, language='zh-CN') print(text)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。