Simple script for TTS in Chinese https://spacecruft.org/Chinese/TTS
Find a file
2026-06-09 12:14:02 -06:00
.gitignore git ignores 2026-06-09 12:03:42 -06:00
.python-version Python 3.13 2026-06-09 12:04:21 -06:00
LICENSE-apache.txt Apache 2.0 2026-06-09 12:03:22 -06:00
README.md rm path from example help 2026-06-09 12:14:02 -06:00
requirements-dev.txt dev deps 2026-06-09 12:04:07 -06:00
requirements.txt py deps 2026-06-09 12:04:00 -06:00
tts.py Draft TTS script 2026-06-09 12:05:03 -06:00

Chinese TTS

Chinese TTS scripts using Alibaba's Qwen.

Upstream

Install

Dependencies:

sudo apt install sox
pip install -r requirements.txt

Usage

./tts.py

The first time it is run it will download a ~4 GB model from huggingface.

Help

$ ./tts.py --help

usage: tts.py [-h] [--text-file PATH] [-o PATH] [--speaker {Dylan,Serena,Uncle_Fu,Vivian}] [--list-speakers] [--slow | --fast] [--seed SEED] [--temperature TEMPERATURE] [--top-k TOP_K]
              [--top-p TOP_P] [--repetition-penalty REPETITION_PENALTY] [--max-new-tokens MAX_NEW_TOKENS]
              [text]

Synthesize Standard Mandarin Chinese speech with Qwen3-TTS.

positional arguments:
  text                  Chinese text to synthesize (final positional argument).

options:
  -h, --help            show this help message and exit
  --text-file PATH      Read text to synthesize from a file instead of the positional argument.
  -o, --output PATH     Output WAV filename. Defaults to an auto-incrementing output-NNN.wav.
  --speaker {Dylan,Serena,Uncle_Fu,Vivian}
                        Built-in speaker voice (default: Uncle_Fu).
  --list-speakers       List the selectable speaker voices and exit.
  --slow                Speak slowly (default).
  --fast                Speak at normal speed.
  --seed SEED           Random seed for reproducible sampling (optional).
  --temperature TEMPERATURE
                        Sampling temperature (optional).
  --top-k TOP_K         Top-k sampling (optional).
  --top-p TOP_P         Top-p sampling (optional).
  --repetition-penalty REPETITION_PENALTY
                        Repetition penalty (optional).
  --max-new-tokens MAX_NEW_TOKENS
                        Maximum number of new tokens to generate (optional).

examples:
  tts.py "你好,世界。"
  tts.py --fast --speaker Vivian "今天天气很好。"
  tts.py --text-file story.txt -o story.wav
  tts.py --list-speakers

License

Apache 2.0 License. See LICENSE-apache.txt for details.

Copyright © 2026 Jeff Moe