我一直在使用谷歌语音识别的Python。下面是我的代码:
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
print(r.recognize_google(audio))
虽然识别非常准确,但它需要大约4-5秒才能吐出识别出的文本。因为我正在创建一个语音助手,所以我想修改上面的代码,以使语音识别速度更快。
有没有办法把这个数字降到大约1-2秒?如
我目前正在使用来自nuget for xamarin form项目的谷歌语音云Beta1包: Google.Apis.CloudSpeechAPI.v1beta1。我设法发送了从麦克风捕获的音频,并将整个音频发送到speech cloud以获取结果。
var speechRequest = new SyncRecognizeRequest();
speechRequest.Config = new RecognitionConfig();
speechRequest.Config.SampleRate = 1600