Qwen3-TTS
使用 Qwen3-TTS,在聲音複製與文字描述的 VoiceDesign 兩種模式下合成高度準確的多語言角色語音。
Qwen3-TTS 12Hz 1.7B 提供高精確度的本機語音合成。在預設的自動模式下執行 servers/tts/qwen3tts/server.py,會根據每個傳入的請求動態選取 Base 聲音複製模型或 VoiceDesign 模型。
從 TomoriBot 存放庫根目錄(你複製 TomoriBot 的資料夾)執行這些指令:
Windows PowerShell
Section titled “Windows PowerShell”python -m venv servers\tts\qwen3tts\.venvservers\tts\qwen3tts\.venv\Scripts\Activate.ps1python -m pip install --upgrade pippip install -r servers\tts\qwen3tts\requirements.txtpython servers\tts\qwen3tts\server.pyLinux 與 macOS Bash
Section titled “Linux 與 macOS Bash”python3 -m venv servers/tts/qwen3tts/.venvsource servers/tts/qwen3tts/.venv/bin/activatepython -m pip install --upgrade pippython -m pip install -r servers/tts/qwen3tts/requirements.txtpython servers/tts/qwen3tts/server.py預設的自動模式端點 URL 為 http://127.0.0.1:8012;設定 QWEN3TTS_PORT 可使用其他連接埠。你也可以明確指定自動模式:
python servers\tts\qwen3tts\server.py --mode auto自動模式會檢查每個 /synthesize 請求:帶有 ref_audio 的請求使用複製模型,而帶有 instruct 的請求使用 VoiceDesign 模型。它一次只會在記憶體中保留一個模型,並在請求類型變更時切換模型,因此切換後的第一次請求可能會較慢。
選用:更快的 CUDA 後端
Section titled “選用:更快的 CUDA 後端”在 NVIDIA GPU 上,啟動伺服器前設定 QWEN3TTS_BACKEND=cuda-graphs 即可使用 faster-qwen3-tts,requirements 已包含安裝。合成速度約快 6 倍,因此執行速度比即時更快,而非慢約兩倍。針對相同的輸入,其輸出與預設後端並非完全逐位元相同。
此後端會為每次請求保留固定長度的語音空間,由參考片段與生成的音訊共用(總共約 170 秒)。搭配 10 到 20 秒的片段使用時,仍留有超過兩分鐘的語音空間。若請求超出此空間,伺服器會傳回錯誤而非截斷音訊;請使用較短的片段或文字,或改用預設的 transformers 後端。
$env:QWEN3TTS_BACKEND = "cuda-graphs"python servers\tts\qwen3tts\server.py在 TomoriBot 中註冊
Section titled “在 TomoriBot 中註冊”對於大多數使用者,請註冊自動模式伺服器,讓單一端點能同時支援聲音複製與 VoiceDesign 人格。
執行 /providers,選擇 + 新增自訂端點,並使用語音 API 相容性:
- API Compatibility:
tts-clone endpoint_url:http://127.0.0.1:8012
儲存連線後,選取它並使用其模型下拉選單新增 Speech 模型。模型表單會詢問 語音來源模式 與 腳本標記風格;自動模式伺服器請選擇 自動 與 純文字。
使用 /providers 進行端點註冊與模型設定。接著開啟 /config > 模型 > 切換模型 以選取並啟用已註冊的端點。
設定人格語音
Section titled “設定人格語音”適用於需要模仿參考音訊的人格:
- 準備一段乾淨的 10 到 20 秒語音音訊,單一講者且無背景音樂。
- 在
/config的 模型 > TTS 參數與語音 底下上傳該音訊。 - 在
/config的 人格 > 語音 底下選擇人格與語音樣本。
Qwen3-TTS 支援短至 3 秒的參考音訊片段。
VoiceDesign
Section titled “VoiceDesign”適用於使用文字語音描述而非音訊樣本的人格:
- 開啟
/config底下的 人格 > 語音,並選擇 VoiceDesign。 - 選擇人格。
- 輸入自然語言語音提示詞,例如講者的年齡、語氣、口音與發音風格。
選用:僅限 VoiceDesign 伺服器
Section titled “選用:僅限 VoiceDesign 伺服器”提供 Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign 服務時,可直接以 VoiceDesign 模式啟動同一個伺服器。
Windows PowerShell:
servers\tts\qwen3tts\.venv\Scripts\Activate.ps1$env:TOMORI_TTS_MODE = "voice-design"python servers\tts\qwen3tts\server.pyBash:
source servers/tts/qwen3tts/.venv/bin/activateTOMORI_TTS_MODE=voice-design python servers/tts/qwen3tts/server.py你也可以傳入 --mode voice-design 代替設定 TOMORI_TTS_MODE。預設的僅限 VoiceDesign 端點 URL 為 http://127.0.0.1:8014。
註冊方式與自動模式相同,但端點 URL 請使用 http://127.0.0.1:8014,並在 Speech 模型上選擇 VoiceDesign 作為語音來源模式。