You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何延长Microsoft Speech Service SDK单次监听超时时间?

解决Microsoft Speech Service SDK语音转文本超时问题

要延长语音转文本的监听超时(从默认60秒调整到80秒),可通过配置会话参数实现,具体操作如下:

1. 配置核心超时参数

主要通过调整MaxSpeechTimeoutMs(最长语音输入时长)和EndSilenceTimeoutMs(静音结束后等待识别的时长)两个参数来实现需求:

  • C# SDK示例:
    初始化识别器时,通过SpeechRecognitionSettings配置参数:
    var settings = new SpeechRecognitionSettings();
    // 设置最长语音输入时长为80秒
    settings.MaxSpeechTimeoutMs = 80000;
    // 设置静音检测超时(例:检测到2秒静音后结束当前识别)
    settings.EndSilenceTimeoutMs = 2000;
    var recognizer = new SpeechRecognizer(speechConfig, audioConfig, settings);
    
  • Python SDK示例:
    通过SpeechConfig的set_property方法设置对应属性:
    speech_config = speechsdk.SpeechConfig(subscription=subscription_key, region=region)
    # 设置最长语音输入时长为80秒
    speech_config.set_property(speechsdk.PropertyId.SpeechServiceConnection_MaxSpeechTimeoutMs, "80000")
    # 设置静音结束超时
    speech_config.set_property(speechsdk.PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, "2000")
    recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config)
    

2. 关键注意事项

  • 确认你的Azure Speech Service资源配额支持自定义超时,部分免费层可能存在限制,需核对资源配置。
  • 当前Azure Speech Service允许的单段语音最长时长上限为120秒,设置80秒在允许范围内。
  • 若需要持续监听多段语音,可在每段识别完成后重新初始化识别器,实现连续会话。

内容的提问来源于stack exchange,提问作者Abdullah Nadeem

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 11:42:36