Skip to content

Instantly share code, notes, and snippets.

@rahulvramesh
Last active September 6, 2023 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulvramesh/64115268089c18013702d9af7126b547 to your computer and use it in GitHub Desktop.
Save rahulvramesh/64115268089c18013702d9af7126b547 to your computer and use it in GitHub Desktop.

~ Tansen ~

Democratizing access to LLMs for the open-source community.
Let's advance AI, together.


🎉 Tansen

Tansen is a text-to-speech program built with the following priorities:

  1. Strong multi-voice capabilities.
  2. Highly realistic prosody and intonation.
  3. speaking rate control

🎧 Demos

Open In Colab Open in Spaces

💻 Getting Started on GitHub

Ready to dive in? Here's how you can get started with our repo on GitHub.

1️⃣ : Clone our GitHub repository

First things first, you'll need to clone our repository. Open up your terminal, navigate to the directory where you want the repository to be cloned, and run the following command:

conda create --name Tansen python=3.9 numba inflect
conda activate Tansen
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
conda install transformers=4.29.2
git clone https://github.com/BudEcosystem/Tansen.git
cd Tansen

2️⃣ : Install dependencies

python setup.py install

3️⃣ : Generate Audio

do_tts.py

This script allows you to speak a single phrase with one or more voices.

python do_tts.py --text "I'm going to speak this" --voice random --preset fast

read.py

This script provides tools for reading large amounts of text.

python Tansen/read.py --textfile <your text to be read> --voice random

This will break up the textfile into sentences, and then convert them to speech one at a time. It will output a series of spoken clips as they are generated. Once all the clips are generated, it will combine them into a single file and output that as well.

Sometimes Tansen screws up an output. You can re-generate any bad clips by re-running read.py with the --regenerate argument.

Intrested in running as as API ?

🐍 Usage in Python

Tansen can be used programmatically :

reference_clips = [utils.audio.load_audio(p, 22050) for p in clips_paths]
tts = api.TextToSpeech(use_deepspeed=True, kv_cache=True, half=True)
pcm_audio = tts.tts_with_preset("your text here", voice_samples=reference_clips, preset='fast')

Training Information

Device : A Single A100

Dataset : 876 hours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment