A newer version of the Gradio SDK is available:
5.20.0
title: Spark-TTS
emoji: ⚡
colorFrom: yellow
colorTo: yellow
sdk: gradio
sdk_version: 5.19.0
app_file: webui.py
pinned: false
license: apache-2.0
short_description: (Unofficial) Gradio demo for Spark-TTS
models:
- SparkAudio/Spark-TTS-0.5B
tags:
- text-to-speech
- voice-cloning
- speech-synthesis
python_version: '3.12'
Spark-TTS
Official PyTorch code for inference of
Spark-TTS: An Efficient LLM-Based Text-to-Speech Model with Single-Stream Decoupled Speech Tokens
Spark-TTS 🔥
Overview
Spark-TTS is an advanced text-to-speech system that uses the power of large language models (LLM) for highly accurate and natural-sounding voice synthesis. It is designed to be efficient, flexible, and powerful for both research and production use.
Key Features
- Simplicity and Efficiency: Built entirely on Qwen2.5, Spark-TTS eliminates the need for additional generation models like flow matching. Instead of relying on separate models to generate acoustic features, it directly reconstructs audio from the code predicted by the LLM. This approach streamlines the process, improving efficiency and reducing complexity.
- High-Quality Voice Cloning: Supports zero-shot voice cloning, which means it can replicate a speaker's voice even without specific training data for that voice. This is ideal for cross-lingual and code-switching scenarios, allowing for seamless transitions between languages and voices without requiring separate training for each one.
- Bilingual Support: Supports both Chinese and English, and is capable of zero-shot voice cloning for cross-lingual and code-switching scenarios, enabling the model to synthesize speech in multiple languages with high naturalness and accuracy.
- Controllable Speech Generation: Supports creating virtual speakers by adjusting parameters such as gender, pitch, and speaking rate.
Inference Overview of Voice Cloning![]() |
Inference Overview of Controlled Generation![]() |
Install
Clone and Install
Here are instructions for installing on Linux. If you're on Windows, please refer to the Windows Installation Guide.
(Thanks to @AcTePuKc for the detailed Windows instructions!)
- Clone the repo
git clone https://github.com/SparkAudio/Spark-TTS.git
cd Spark-TTS
- Install Conda: please see https://docs.conda.io/en/latest/miniconda.html
- Create Conda env:
conda create -n sparktts -y python=3.12
conda activate sparktts
pip install -r requirements.txt
# If you are in mainland China, you can set the mirror as follows:
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com
Model Download
Download via python:
from huggingface_hub import snapshot_download
snapshot_download("SparkAudio/Spark-TTS-0.5B", local_dir="pretrained_models/Spark-TTS-0.5B")
Download via git clone:
mkdir -p pretrained_models
# Make sure you have git-lfs installed (https://git-lfs.com)
git lfs install
git clone https://huggingface.co./SparkAudio/Spark-TTS-0.5B pretrained_models/Spark-TTS-0.5B
Basic Usage
You can simply run the demo with the following commands:
cd example
bash infer.sh
Alternatively, you can directly execute the following command in the command line to perform inference:
python -m cli.inference \
--text "text to synthesis." \
--device 0 \
--save_dir "path/to/save/audio" \
--model_dir pretrained_models/Spark-TTS-0.5B \
--prompt_text "transcript of the prompt audio" \
--prompt_speech_path "path/to/prompt_audio"
Web UI Usage
You can start the UI interface by running python webui.py --device 0
, which allows you to perform Voice Cloning and Voice Creation. Voice Cloning supports uploading reference audio or directly recording the audio.
Demos
Here are some demos generated by Spark-TTS using zero-shot voice cloning. For more demos, visit our demo page.
Donald Trump |
Zhongli (Genshin Impact) |
陈鲁豫 Chen Luyu |
杨澜 Yang Lan |
余承东 Richard Yu |
马云 Jack Ma |
刘德华 Andy Lau |
徐志胜 Xu Zhisheng |
哪吒 Nezha |
李靖 Li Jing |
To-Do List
- Release the Spark-TTS paper.
- Release the training code.
- Release the training dataset, VoxBox.