我希望Azure语音到文本服务在开始识别语音之前至少等待1分钟。或者说话者自己在完成演讲后点击按钮,然后Azure语音到文本服务应该开始从语音中识别文本。
我试过下面的代码,但它不工作
const speechConfig = SpeechConfig.fromSubscription(
subscriptionKey,
serviceRegion,
);
const audioConfig = AudioConfig.fromDefaultMicrophoneInput();
speechConfig.setProperty(
PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs,
'60000',
);
const recognizer = new SpeechRecognizer(speechConfig, audioConfig);
recognizer.startContinuousRecognitionAsync();
console.log(new Date().toString());
recognizer.recognizeOnceAsync((result) => {
if (result.reason === ResultReason.RecognizedSpeech) {
const recognized = result.text;
console.log(new Date().toString());
console.log(recognized);
}}
字符串
1条答案
按热度按时间wfauudbj1#
我得到了答案,Speech_SegmentationSilenceTimeoutMs中允许的最大值是5000,
下面是更新后的代码
字符串