ChatTTS Voice Generator
AI-optimized conversational text-to-speech using a local ChatTTS server. Designed to generate highly natural human voices with realistic laughs, breathing, and pauses.
Generate Speech
CODEBLOCK0
Options
- -
--seed <number>: Random seed to fix the speaker's voice/timbre (default: 2048). Change this number to switch between different male/female voices. - INLINECODE1 : Controls the emotional variance and stability (default: 0.3). Lower is more stable and clear, higher (e.g., 0.6) is more expressive but might mumble.
- INLINECODE2 : Top P sampling parameter for voice generation (default: 0.7).
Notes
- - Requires the local ChatTTS FastAPI server to be running (default target: http://172.23.252.114:8020).
- Ensure CHATTTSAPIURL is set in your .env file if the API is hosted on a different machine.
- PRO TIP: Always try to insert [laugh] (laughter) and [uv_break] (pauses/breaths) into the text to make the generated voice sound exactly like a real human.
- The script will return the absolute local file path of the generated .wav audio file.
ChatTTS 语音生成器
使用本地 ChatTTS 服务器进行AI优化的对话式文本转语音。旨在生成高度自然的人类语音,包含逼真的笑声、呼吸和停顿。
生成语音
bash
node {baseDir}/scripts/tts.mjs 你要转换的语音文本
node {baseDir}/scripts/tts.mjs 你好啊![laugh] 今天天气真不错,[uv_break] 我们出去玩吧? --seed 2048
node {baseDir}/scripts/tts.mjs 写代码真是太开心了! --seed 1234 --temperature 0.5
选项
- - --seed <数字>: 用于固定说话人声音/音色的随机种子(默认值:2048)。更改此数字可在不同男声/女声之间切换。
- --temperature <浮点数>: 控制情感变化和稳定性(默认值:0.3)。数值越低越稳定清晰,数值越高(如0.6)表现力更强但可能出现含糊不清。
- --top_p <浮点数>: 语音生成的Top P采样参数(默认值:0.7)。
注意事项
- - 需要本地ChatTTS FastAPI服务器正在运行(默认目标地址:http://172.23.252.114:8020)。
- 如果API托管在不同机器上,请确保在.env文件中设置了CHATTTSAPIURL。
- 专业提示:始终尝试在文本中插入[laugh](笑声)和[uv_break](停顿/呼吸),以使生成的语音听起来完全像真人。
- 该脚本将返回生成的.wav音频文件的绝对本地路径。