mcpField
A
aliyun-qwen-tts-realtime

aliyun-qwen-tts-realtime

github.com/cinience创意与媒体39659 次安装11 周前更新
代码仓库

关于 aliyun-qwen-tts-realtime

aliyun-qwen-tts-realtime 是使用 Model Studio 中 Qwen TTS 模型生成低延迟流式语音的技能,附带演示脚本,用于检查当前 SDK 和运行环境的实时兼容性,并可选择非实时回退。

主要功能

  1. 01从文本生成流式语音
  2. 02选择支持的实时模型
  3. 03设置音色和可选指令
  4. 04检查 SDK 与运行环境兼容性
  5. 05使用可选的非实时回退

适用场景

  1. 01生成低延迟语音输出
  2. 02测试环境中的实时 TTS
  3. 03使用指定音色生成语音
  4. 04实时调用不受支持时进行回退

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/cinience/alicloud-skills --skill aliyun-qwen-tts-realtime

安装后在 Claude Code 中输入/aliyun-qwen-tts-realtime确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

agents/
openai.yaml
references/
sources.md
scripts/
realtime_tts_demo.py

详细介绍

类别:provider

Model Studio Qwen TTS 实时

使用实时 TTS 模型,以低延迟流式输出语音。

关键模型名称

请使用以下精确的模型字符串之一:

  • qwen3-tts-flash-realtime
  • qwen3-tts-instruct-flash-realtime
  • qwen3-tts-instruct-flash-realtime-2026-01-22
  • qwen3-tts-vd-realtime-2026-01-15
  • qwen3-tts-vc-realtime-2026-01-15

前置条件

  • 在虚拟环境中安装 SDK:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install dashscope
  • 在环境中设置 DASHSCOPE_API_KEY,或将 dashscope_api_key 添加到 ~/.alibabacloud/credentials。

标准化接口(tts.realtime)

请求
  • text(字符串,必需)
  • voice(字符串,必需)
  • instruction(字符串,可选)
  • sample_rate(整数,可选)
响应
  • audio_base64_pcm_chunks(数组)
  • sample_rate(整数)
  • finish_reason(字符串)

操作指南

  • 实时模式请使用 websocket 或流式端点。
  • 每段语音尽量简短,以降低延迟。
  • 对于指令模型,指令应明确、简洁。
  • 某些 SDK/运行时组合可能会拒绝通过 MultiModalConversation 调用实时模型;请使用下方的探测脚本验证兼容性。

本地演示脚本

使用探测脚本验证当前 SDK/运行时的实时兼容性,也可选择回退到非实时模型以立即输出:

.venv/bin/python skills/ai/audio/aliyun-qwen-tts-realtime/scripts/realtime_tts_demo.py \
  --text "This is a realtime speech demo." \
  --fallback \
  --output output/ai-audio-tts-realtime/audio/fallback-demo.wav

严格模式(用于 CI / 门控):

.venv/bin/python skills/ai/audio/aliyun-qwen-tts-realtime/scripts/realtime_tts_demo.py \
  --text "realtime health check" \
  --strict

输出位置

  • 默认输出:output/ai-audio-tts-realtime/audio/
  • 使用 OUTPUT_DIR 覆盖基础目录。

验证

mkdir -p output/aliyun-qwen-tts-realtime
for f in skills/ai/audio/aliyun-qwen-tts-realtime/scripts/*.py; do
  python3 -m py_compile "$f"
done
echo "py_compile_ok" > output/aliyun-qwen-tts-realtime/validate.txt

通过标准:命令退出码为 0,且已生成 output/aliyun-qwen-tts-realtime/validate.txt。

输出与证据

  • 将产物、命令输出和 API 响应摘要保存在 output/aliyun-qwen-tts-realtime/ 下。
  • 在证据文件中包含关键参数(区域/资源 ID/时间范围),以便复现。

工作流

  1. 确认用户意图、区域、标识符,以及操作是只读还是会修改数据。
  2. 先运行一条最小化只读查询,以验证连接和权限。
  3. 使用明确的参数和有限的范围执行目标操作。
  4. 验证结果并保存输出/证据文件。

参考资料

  • references/sources.md

评论

支持 Markdown