alicloud-tts-lang-voice-matrix.md 6.5 KB

阿里云 TTS 模型 × 语言 × 音色 矩阵

数据来源:阿里云官方 系统预置音色参数与特性列表(本地下载的 tts音色/ 目录) 抓取方式:

  • CosyVoice 4 个模型:v3-flash / v3-plus / v2 / v1,共 216 个音色
  • Qwen3-TTS v3-flash:48 个音色
  • 全文 JSON 数据:/tmp/alicloud-voices-matrix.json

用途:未来"用户选语言"功能的核心数据库 — 用户选 X 语言,后端路由先查表确认有可用音色再调 TTS,避免"用户选了但生成失败"的尴尬


一、模型 × 音色 × 主推语种

模型 音色数 主要语种 Instruct 支持 现状
cosyvoice-v3-flash 88 中文 9 种方言 + 英/日/韩/印尼 ✅(固定格式) ✅ 项目主力
cosyvoice-v3-plus 2 中/英(仅 2 音色) ⚠️ 兼容旧集成
cosyvoice-v2 106 普通话+粤/东北/闽南/陕西+英/日/韩 部分 老牌音色最丰富
cosyvoice-v1 20 普通话 + 东北口音 ❌ 历史,逐步淘汰

⚠️ 特别说明:CosyVoice v3.5 (-plus / -flash) 没有系统音色,只支持"声音复刻"和"声音设计"。复刻/设计音色理论上支持 11 种语言(中/英/法/德/日/韩/俄/葡/泰/印尼/越南),但需先录制训练,不在本表中。


二、语言选择可用性矩阵(用户视角)

用户在 UI 选语言,看哪些模型/音色真的能生成。✅ = 有可用音色

语言 cosyvoice-v3-flash cosyvoice-v3-plus cosyvoice-v2 cosyvoice-v1
中文 ✅ 19
中文(东北) ✅ 1 ✅ 1
中文(东北话) ✅ 1 ✅ 1
中文(四川) ✅ 1
中文(山东) ✅ 1
中文(普通话 ✅ 1
中文(普通话) ✅ 59 ✅ 2 ✅ 78
中文(河南) ✅ 1
中文(湖南) ✅ 1
中文(粤语) ✅ 4 ✅ 3
中文(闽南话) ✅ 1 ✅ 1
中文(陕西) ✅ 1
中文(陕西话) ✅ 1 ✅ 1
英语(美式) ✅ 10 ✅ 10
英语(英式) ✅ 4 ✅ 6
日语 ✅ 5 ✅ 4
韩语 ✅ 2 ✅ 2
印尼语 ✅ 1
安徽话) ✅ 1
英文 ✅ 66 ✅ 2 ✅ 84 ✅ 4

三、推荐配置(给前端语言选择器)

用户在前端选语言后,后端按这套规则路由:

用户选 默认 vendor 模型 默认音色 备选音色
中文普通话 edge / cosyvoice cosyvoice-v3-flash longanhuan_v3(9 种方言) 苏瑶 / 凯
中文(粤语) cosyvoice cosyvoice-v3-flash 龙安粤longanhuan_v3 -
中文(闽南) / 东北 / 河南 / 湖南 / 陕西 / 山东 / 安徽 / 四川 cosyvoice cosyvoice-v3-flash longanhuan_v3 唯一支持多方言 -
中文(闽南) cosyvoice cosyvoice-v3-flash 龙安闽 -
中文(四川) cosyvoice cosyvoice-v3-flash 龙老铁天津-李彼得 -
中文(陕西) cosyvoice cosyvoice-v3-flash 龙陕哥longanhuan_v3 -
中文(北京/上海/南京) (cosyvoice 没专门) / edge edge zh-CN-XiaoxiaoNeural -
英语(美式) qwen / cosyvoice qwen3-tts-instruct-flash 詹妮弗 / 艾登 longandy / longava
英语(英式) qwen / cosyvoice qwen3-tts-instruct-flash Riko / loongluna -
日语 qwen / cosyvoice cosyvoice-v3-flash loongtomoka / loongtomoya / 小野杏 -
韩语 qwen / cosyvoice cosyvoice-v3-flash 素熙 -
法语 / 德语 / 俄语 qwen qwen3-tts-instruct-flash 埃米尔安 / 莱恩 / 阿列克 -
西班牙语 / 拉美西班牙 qwen qwen3-tts-instruct-flash 博德加 / 索尼莎 -
葡萄牙语 qwen qwen3-tts-instruct-flash 拉迪奥·戈尔 -
意大利语 qwen qwen3-tts-instruct-flash 多尔切 -
印尼语 cosyvoice cosyvoice-v3-flash loongindah -

四、实现"用户选语言"功能的代码路径

1. 前端增加语言选择组件

<!-- /pages/create/index.vue -->
<template>
  <picker :range="supportedLanguages" v-model="form.language">
    <view slot="value">{{ form.language.label }}</view>
  </picker>
</template>

<script setup>
// 加载后端 /api/tts/voices?lang=zh-Cantonese 拿到可用音色 + 试听链接
const supportedLanguages = ref([]);
onMounted(async () => {
  const r = await api.get('/api/tts/languages');  // 返回矩阵 → 用户友好列表
  supportedLanguages.value = r.data;
});
</script>

2. 后端路由逻辑(基于矩阵)

// server/src/services/tts-router.ts
import matrix from '../../data/alicloud-tts-lang-voice-matrix.json';

export function pickTtsVendor(lang: string, preferCheap = true) {
  // 1. 查表(矩阵)
  const candidates = matrix.candidates[lang] || [];
  if (candidates.length === 0) throw new BadRequest(`暂不支持 ${lang} 语言`);
  // 2. 优先免费(Edge)
  if (preferCheap) {
    const edge = candidates.find(c => c.vendor === 'edge');
    if (edge) return edge;
  }
  // 3. 默认 cosyvoice-v3-flash
  const v3 = candidates.find(c => c.model === 'cosyvoice-v3-flash');
  if (v3) return v3;
  // 4. 退化到任意可用
  return candidates[0];
}

3. 防呆:用户选语言后实时预览

GET /api/tts/voices?lang=zh-Cantonese
// → { voices: [{ name: "龙安粤", voice_id: "longan_yue_3", preview_url: "..." }] }

4. 矩阵 JSON 入仓

生成好的 216 个音色 JSON 在 C:/Users/caoyg/AppData/Local/Temp/alicloud-voices-matrix.json(4 个模型)。 可以入仓到 server/data/alicloud-tts-lang-voice-matrix.json,启动时加载,提供 pickTtsVendor(lang) API。


五、迁移指引

现在 server/src/modules/tts/tts.service.ts:243ALIYUN_VOICE_MAP 只有 10 个"龙"系列 + Cherry,远不足以覆盖未来"语言选择"功能。建议:

  1. 把矩阵简化版(只存音色 ID 列表)写到 models.json 供前端调用
  2. 后端 pickTtsVendor(lang) 路由函数读这个矩阵
  3. 前端只显示"矩阵确认可生成"的语言选项(不然选错体验崩)

详细矩阵在 alicloud-voices-matrix.json,由 analyze-model-lang-matrix.py + gen-lang-matrix-doc.js 维护。