MCPcopy Index your code
hub / github.com/FireRedTeam/FireRedTTS

github.com/FireRedTeam/FireRedTTS @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
438 symbols 986 edges 38 files 72 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

FireRedTTS: A Foundation Text-To-Speech Framework for Industry-Level Generative Speech Applications

👉🏻 FireRedTTS Paper 👈🏻

👉🏻 FireRedTTS Demos 👈🏻

👉🏻 FireRedTTS Space (Interactive Demo) 👈🏻

News

  • [2024/10/17] 🔥 We release new rich-punctuation model, offering expanded punctuation coverage and enhanced audio production consistency. In addition, we have strengthened the capabilities of the text front-end and enhanced the stability of synthesis.
  • [2024/09/26] 🔥 Our model is already available on huggingface space,try it through the interactive interface.
  • [2024/09/20] 🔥 We release the pre-trained checkpoints and inference code.
  • [2024/09/06] 🔥 We release the technical report and project page

Roadmap

  • [ ] 2024/09
  • [x] Release the pre-trained checkpoints and inference code.
  • [ ] Release testing set.

  • [ ] 2024/10

  • [x] Release rich punctuation version.
  • [ ] Release finetuned checkpoints for controllable human-like speech generation.

Usage

Clone and install

  • Clone the repo
https://github.com/FireRedTeam/FireRedTTS.git
cd FireRedTTS
  • Create conda env
# step1.create env
conda create --name redtts python=3.10

# stpe2.install torch (pytorch should match the cuda-version on your machine)
# CUDA 11.8
conda install pytorch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pytorch-cuda=11.8 -c pytorch -c nvidia
# CUDA 12.1
conda install pytorch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 pytorch-cuda=12.1 -c pytorch -c nvidia

# step3.install fireredtts form source
pip install -e . 

# step4.install other requirements
pip install -r requirements.txt

Download models

Download the required model files from Model_Lists and place them in the folder pretrained_models

Basic Usage

import os
import torchaudio
from fireredtts.fireredtts import FireRedTTS

tts = FireRedTTS(
    config_path="configs/config_24k.json",
    pretrained_path=<pretrained_models_dir>,
)

#same language
rec_wavs = tts.synthesize(
        prompt_wav="examples/prompt_1.wav",
        text="小红书,是中国大陆的网络购物和社交平台,成立于二零一三年六月。",
        lang="zh",
)

rec_wavs = rec_wavs.detach().cpu()
out_wav_path = os.path.join("./example.wav")
torchaudio.save(out_wav_path, rec_wavs, 24000)

Tips

  • Removing the long silence (>1s) in the middle of prompt_wav may bring better stability. If there are too many long silences in your prompt_wav and it causes stability problems, it is recommended to use our tool(tools/process_prompts.py) to remove the silence.

Acknowledgements

  • Tortoise-tts and XTTS-v2 offer invaluable insights for constructing an autoregressive-style system.
  • Matcha-TTS and CosyVoice demonstrate the excellent ability of flow-matching in converting audio code to mel.

  • BigVGAN-v2, utilized for vocoding.

  • We referred to whisper’s text tokenizer solution.

Core symbols most depended-on inside this repo

get_padding
called by 8
fireredtts/modules/bigvgan/bigvgan.py
WNConv1d
called by 7
fireredtts/modules/acoustic_codec/bigcodec.py
utf_8_len
called by 5
fireredtts/utils/spliter.py
modulate
called by 4
fireredtts/modules/flowmatching/estimator_dit.py
apply_parametrization_norm
called by 4
fireredtts/modules/semantic_tokenizer/semantic_tokenizer.py
get_norm_module
called by 4
fireredtts/modules/semantic_tokenizer/semantic_tokenizer.py
dequantize
called by 3
fireredtts/modules/acoustic_codec/vector_quantization.py
encode
called by 3
fireredtts/modules/acoustic_codec/vector_quantization.py

Shape

Method 275
Class 96
Function 67

Languages

Python100%

Modules by API surface

fireredtts/modules/semantic_tokenizer/semantic_tokenizer.py66 symbols
fireredtts/modules/acoustic_codec/bigcodec.py60 symbols
fireredtts/modules/semantic_tokenizer/ecapa_tdnn.py35 symbols
fireredtts/modules/acoustic_codec/vector_quantization.py33 symbols
fireredtts/modules/flowmatching/estimator_dit.py32 symbols
fireredtts/modules/acoustic_llm/acoustic_llm.py32 symbols
fireredtts/modules/flowmatching/upsample_encoder.py31 symbols
fireredtts/modules/semantic_llm/llm_gpt2.py27 symbols
fireredtts/modules/bigvgan/bigvgan.py14 symbols
fireredtts/modules/text_normalizer/utils.py10 symbols
fireredtts/models/token2audio.py10 symbols
fireredtts/modules/semantic_tokenizer/audio.py9 symbols

For agents

$ claude mcp add FireRedTTS \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact