1、使用AI语音识别工具
Google SpeechtoText:Google提供的语音识别API,可以将音频转换为文本。
IBM Watson Speech to Text:IBM的语音识别服务,支持多种语言。
Microsoft Azure Speech Service:微软的语音识别服务,支持实时和批量处理。
with audio_file as source:
audio = recognizer.record(source)
使用Google SpeechtoText进行识别
try:
text = recognizer.recognize_google(audio, language='zhCN')
print(识别结果:, text)
except sr.UnknownValueError:
print(Google Speech Recognition could not understand audio)
except sr.RequestError as e:
print(fCould not request results from Google Speech Recognition service; {e})