readme: # TorToiSe
  
  Tortoise is a text-to-speech program built with the following priorities:
  
  1. Strong multi-voice capabilities.
  2. Highly realistic prosody and intonation.
  
  This repo contains all the code needed to run Tortoise TTS in inference mode.
  
  ### New features
  
  #### v2.3; 2022/5/12
  - New CLVP-large model for further improved decoding guidance.
  - Improvements to read.py and do_tts.py (new options)
  
  #### v2.2; 2022/5/5
  - Added several new voices from the training set.
  - Automated redaction. Wrap the text you want to use to prompt the model but not be spoken in brackets.
  - Bug fixes
  
  #### v2.1; 2022/5/2
  - Added ability to produce totally random voices.
  - Added ability to download voice conditioning latent via a script, and then use a user-provided conditioning latent.
  - Added ability to use your own pretrained models.
  - Refactored directory structures.
  - Performance improvements & bug fixes.
  
  ## What's in a name?
  
  I'm naming my speech-related repos after Mojave desert flora and fauna. Tortoise is a bit tongue in cheek: this model
  is insanely slow. It leverages both an autoregressive decoder **and** a diffusion decoder; both known for their low
  sampling rates. On a K80, expect to generate a medium sized sentence every 2 minutes.
  
  ## Demos
  
  See [this page](http://nonint.com/static/tortoise_v2_examples.html) for a large list of example outputs.
  
  ## Usage guide
  
  ### Colab
  
  Colab is the easiest way to try this out. I've put together a notebook you can use here:
  https://colab.research.google.com/drive/1wVVqUPqwiDBUVeWWOUNglpGhU3hg_cbR?usp=sharing
  
  ### Local Installation
  
  If you want to use this on your own computer, you must have an NVIDIA GPU. 
  
  First, install pytorch using these instructions: [https://pytorch.org/get-started/locally/](https://pytorch.org/get-started/locally/).
  On Windows, I **highly** recommend using the Conda installation path. I have been told that if you do not do this, you
  will spend a lot of time chasing dependency problems.
  
  Next, install TorToiSe and it's dependencies:
  
  ```shell
  git clone https://github.com/neonbjb/tortoise-tts.git
  cd tortoise-tts
  python setup.py install
  ```
  
  If you are on windows, you will also need to install pysoundfile: `conda install -c conda-forge pysoundfile`
  
  ### do_tts.py
  
  This script allows you to speak a single phrase with one or more voices.
  ```shell
  python tortoise/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.
  
  ```shell
  python tortoise/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 Tortoise screws up an output. You can re-generate any bad clips by re-running `read.py` with the --regenerate
  argument.
  
  ### API
  
  Tortoise can be used programmatically, like so:
  
  ```python
  reference_clips = [utils.audio.load_audio(p, 22050) for p in clips_paths]
  tts = api.TextToSpeech()
  pcm_audio = tts.tts_with_preset("your text here", reference_clips, preset='fast')
  ```
  
  ## Voice customization guide
  
  Tortoise was specifically trained to be a multi-speaker model. It accomplishes this by consulting reference clips.
  
  These reference clips are recordings of a speaker that you provide to guide speech generation. These clips are used to determine many properties of the output, such as the pitch and tone of the voice, speaking speed, and even speaking defects like a lisp or stuttering. The reference clip is also used to determine non-voice related aspects of the audio output like volume, background noise, recording quality and reverb.
  
  ### Random voice
  
  I've included a feature which randomly generates a voice. These voices don't actually exist and will be random every time you run 
  it. The results are quite fascinating and I recommend you play around with it!
  
  You can use the random voice by passing in 'random' as the voice name. Tortoise will take care of the rest.
  
  For the those in the ML space: this is created by projecting a random vector onto the voice conditioning latent space.
  
  ### Provided voices
  
  This repo comes with several pre-packaged voices. Voices prepended with "train_" came from the training set and perform
  far better than the others. If your goal is high quality speech, I recommend you pick one of them. If you want to see
  what Tortoise can do for zero-shot mimicing, take a look at the others.
  
  ### Adding a new voice
  
  To add new voices to Tortoise, you will need to do the following:
  
  1. Gather audio clips of your speaker(s). Good sources are YouTube interviews (you can use youtube-dl to fetch the audio), audiobooks or podcasts. Guidelines for good clips are in the next section.
  2. Cut your clips into ~10 second segments. You want at least 3 clips. More is better, but I only experimented w