Skip to content

fix(voice): 修复 MiMo TTS 无效音色与 TTS 配置后未自动激活、添加流式低延迟输出 - #331

Merged
jubaoliang merged 1 commit into
TencentCloud:developfrom
miaowmint:fix/mimo-voice-tts-stt
Aug 19, 2026
Merged

fix(voice): 修复 MiMo TTS 无效音色与 TTS 配置后未自动激活、添加流式低延迟输出#331
jubaoliang merged 1 commit into
TencentCloud:developfrom
miaowmint:fix/mimo-voice-tts-stt

Conversation

@miaowmint

Copy link
Copy Markdown
Contributor

Summary

问题与修复

  1. TTS 配置后未自动设为当前:STT 配置完成后会自动激活,TTS 却不会,
    行为不对称。现与 STT 对齐——配置 TTS 提供商后,若当前仍为 browser 则自动切换。

  2. 无效音色 mimo_default:该 ID 并非官方预置音色(V2 时代概念,V2.5 已按
    集群映射为冰糖/Mia),实际请求会报 invalid voice。UI 下拉框已移除并默认
    「冰糖」;后端将存量 mimo_default 配置自动映射为冰糖,旧配置无需改动。

  3. MiMo TTS 需等待整段合成完才出声:原实现为非流式请求 + 前端整包缓冲,
    长文本延迟数秒。现全链路流式:

    • 后端按文档要求以 pcm16 + stream 请求,实时解析 SSE 音频块并封装为
      流式 WAV(24kHz PCM16LE 单声道)
    • 路由按 provider 返回正确的 Content-Type(mimo→audio/wav)
    • 前端新增流式 fetch 与 WebAudio 播放器,首块到达即出声;
      非 WAV 提供商自动回落原缓冲路径,OpenAI/腾讯云/Edge 行为不变

测试

  • 新增后端单测(音色归一化、WAV 头、SSE 多行 JSON 拼接、流式输出)
  • 新增前端单测(WAV 头解析、PCM16 解码、半帧缓冲)
  • 后端 174 个单测通过;前端 tsc / vitest / eslint / prettier 全绿
  • 已对接 MiMo 线上 API 实测流式播放延迟

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (release/* or hotfix/* only)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore
  • Release / hotfix

Test plan

  • make all passes locally
  • Added/updated tests

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed)

…o-activate

1. TTS providers now auto-activate after configuration when the active
   TTS is still "browser", mirroring the existing STT behavior.

2. Remove the invalid "mimo_default" voice option (not a valid MiMo
   preset voice ID). The UI defaults to 冰糖; the backend maps legacy
   "mimo_default" configs to 冰糖 so existing setups keep working.

3. MiMo TTS low-latency streaming end to end:
   - Backend: request pcm16 + stream, parse SSE audio chunks and wrap
     them in a live WAV container (24kHz PCM16LE mono)
   - Router: return audio/wav for mimo, audio/mpeg otherwise
   - Frontend: stream the response via requestStream and play chunks
     incrementally with WebAudio (WavStreamPlayer), falling back to the
     buffered blob path for non-WAV providers
@miaowmint
miaowmint changed the base branch from main to develop August 18, 2026 05:30
@jubaoliang
jubaoliang merged commit aa8759e into TencentCloud:develop Aug 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants