[!TIP] TL;DR:
- Pandrator is not an AI model itself, but a GUI framework for Text-to-Speech projects. It can generate audiobooks and dubbing by leveraging several AI tools, custom workflows and algorithms. It works on Windows out of the box. It does work on Linux, but you have to perform a manual installation at the moment.
- The easiest way to use it is to download one of the precompiled archives - simply unpack them and use the included launcher. See this table for their contents and sizes.
- You can talk to me or share tips/workflows/ideas on the Discord server.
This video shows the process of launching Pandrator, selecting a source file, starting generation, stopping it and previewing the saved file. It has not been sped up as it's intended to illustrate the real performance (you may skip the first 35s when the XTTS server is launching, and please remember to turn on the sound).
https://github.com/user-attachments/assets/7cab141a-e043-4057-8166-72cb29281c50
And here you can see the dubbing workflow - from a YT video, through transcription, translation, speech generation to synchronisation.
https://github.com/user-attachments/assets/dfd4b6e8-3eda-49e4-bff4-f1683ec4cf21
Pandrator aspires to be easy to use and install - it has a one-click installer and a graphical user interface. It is a tool designed to perform two tasks:
It leverages the XTTS, Silero and VoiceCraft model(s) for text-to-speech conversion and voice cloning, enhanced by RVC_CLI for quality improvement and better voice cloning results, and NISQA for audio quality evaluation. Additionally, it incorporates Text Generation Webui's API for local LLM-based text pre-processing, enabling a wide range of text manipulations before audio generation.
XTTS supports English (en), Spanish (es), French (fr), German (de), Italian (it), Portuguese (pt), Polish (pl), Turkish (tr), Russian (ru), Dutch (nl), Czech (cs), Arabic (ar), Chinese (zh-cn), Japanese (ja), Hungarian (hu) and Korean (ko). Silero supports
[!NOTE] Please note that Pandrator is still in an alpha stage and I'm not an experienced developer (I'm a noob, in fact), so the code is far from perfect in terms of optimisation, features and reliability. Please keep this in mind and contribute, if you want to help me make it better.
The samples were generated using the minimal settings - no LLM text processing, RVC or TTS evaluation, and no sentences were regenerated. Both XTTS and Silero generations were faster than playback speed.
https://github.com/user-attachments/assets/1c763c94-c66b-4c22-a698-6c4bcf3e875d
https://github.com/lukaszliniewicz/Pandrator/assets/75737665/bbb10512-79ed-43ea-bee3-e271b605580e
https://github.com/lukaszliniewicz/Pandrator/assets/75737665/118f5b9c-641b-4edd-8ef6-178dd924a883
Dubbing sample, including translation (video source):
https://github.com/user-attachments/assets/1ba8068d-986e-4dec-a162-3b7cc49052f4
Tool | CPU Requirements | GPU Requirements |
---|---|---|
XTTS | A reasonably modern CPU with 4+ cores (for CPU-only generation) | NVIDIA GPU with 4GB+ of VRAM for good performance |
Silero | Performs well on most CPUs regardless of core count | N/A |
VoiceCraft | Usable on CPU, but generation will be slow | NVIDIA GPU with 8GB+ of VRAM for acceleration (4GB VRAM requires kv cache disabled) |
This project relies on several APIs and services (running locally) and libraries, notably:
.txt
files into sentences, customtkinter by TomSchimansky, num2words by savoirfairelinux, and many others. For a full list, see requirements.txt
.I've prepared packages (archives) that you can simply unpack - everything is preinstalled in its own portable conda environment. You can download them from here.
You can use the launcher to start Pandrator, update it and install new features.
Package | Contents | Unpacked Size |
---|---|---|
1 | Pandrator and Silero | 4GB |
2 | Pandrator and XTTS | 14GB |
3 | Pandrator, XTTS, RVC, WhisperX (for dubbing) and XTTS fine-tuning | 36GB |
Run pandrator_installer_launcher.exe
with administrator priviliges. You will find it under Releases. The executable was created using pyinstaller from pandrator_installer_launcher.py
in the repository.
The file may be flagged as a threat by antivirus software, so you may have to add it as an exception.
You can choose which TTS engines to install and whether to install the software that enables RVC voice cloning (RVC Python), dubbing (WhisperX) and XTTS fine-tuning (Easy XTTS Trainer). You may install more components later.
The Installer/Launcher performs the following tasks:
Note: You can use the Installer/Launcher to launch Pandrator and all the tools at any moment.
If you want to perform the setup again, remove the Pandrator folder it created. Please allow at least a couple of minutes for the initial setup process to download models and install dependencies. Depending on the options you've chosen, it may take up to 30 minutes.
For additional functionality not yet included in the installer:
--api
to CMD_FLAGS.txt
in the main directory of the Webui before starting it).Please refer to the repositories linked under Dependencies for detailed installation instructions. Remember that the APIs must be running to make use of the functionalities they offer.
Install dependencies:
winget install --id Microsoft.VisualStudio.2022.BuildTools --override "--quiet --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended" --accept-package-agreements --accept-source-agreements
Clone the repositories:
mkdir Pandrator
cd Pandrator
git clone https://github.com/lukaszliniewicz/Pandrator.git
git clone https://github.com/lukaszliniewicz/Subdub.git
Create and activate a conda environment:
conda create -n pandrator_installer python=3.10 -y
conda activate pandrator_installer
Install Pandrator and Subdub requirements:
cd Pandrator
pip install -r requirements.txt
cd ../Subdub
pip install -r requirements.txt
cd ..
(Optional) Install XTTS:
git clone https://github.com/daswer123/xtts-api-server.git
conda create -n xtts_api_server_installer python=3.10 -y
conda activate xtts_api_server_installer
pip install torch==2.1.1+cu118 torchaudio==2.1.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
pip install xtts-api-server
(Optional) Install Silero:
conda create -n silero_api_server_installer python=3.10 -y
conda activate silero_api_server_installer
pip install silero-api-server
(Optional) Install RVC (Retrieval-based Voice Conversion):
conda activate pandrator_installer
pip install pip==24
pip install rvc-python
pip install torch==2.1.1+cu118 torchaudio==2.1.1+cu118 --index-url https://download.pytorch.org/whl/cu118
(Optional) Install WhisperX:
conda create -n whisperx_installer python=3.10 -y
conda activate whisperx_installer
conda install git -c conda-forge -y
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
conda install cudnn=8.9.7.29 -c conda-forge -y
conda install ffmpeg -c conda-forge -y
pip install git+https://github.com/m-bain/whisperx.git
(Optional) Install XTTS Fine-tuning:
git clone https://github.com/lukaszliniewicz/easy_xtts_trainer.git
conda create -n easy_xtts_trainer python=3.10 -y
conda activate easy_xtts_trainer
cd easy_xtts_trainer
pip install -r requirements.txt
pip install torch==2.1.1+cu118 torchaudio==2.1.1+cu118 --index-url https://download.pytorch.org/whl/cu118
cd ..
Run Pandrator:
conda activate pandrator_installer
cd Pandrator
python pandrator.py
Run XTTS API Server (if installed):
conda activate xtts_api_server_installer
python -m xtts_api_server
Additional options:
--device cpu
--lowvram
--deepspeed
Run Silero API Server (if installed):
conda activate silero_api_server_installer
python -m silero_api_server
After installation, your folder structure should look like this:
Pandrator/
├── Pandrator/
├── Subdub/
├── xtts-api-server/ (if XTTS is installed)
├── easy_xtts_trainer/ (if XTTS Fine-tuning is installed)
For more detailed information on using specific components or troubleshooting, please refer to the documentation of each individual repository.
If you don't want to use the additional features like RVC, you have everything you need in the Session tab.
Either create a new session or load an existing one (select a folder in Outputs
to do that).
Choose a .txt
, .srt
, .pdf
, .epub
, .mobi
or .docx
file. If you choose a PDF or EPUB file, a preview window will open with the extracted text. You may edit it (OCRed books often have poorly recognized text from the title page, for example) and check/add Chapter markers (they will be created automatically for EPUB files). For PDFs, you will have the option to crop the pages to remove headers/footers as well as to remove unneeded pages (like the title page or the table of contents). Files that contain a lot of text, regardless of format, can take a moment to finish preprocessing before generation begins. The GUI will freeze, but as long as there is processor activity, it's simply working.
.wav
files (22050hz sample rate, mono) stored in the tts_voices
directory (Pandrator/Pandrator/tts_voices
). You can upload and select them via the GUI. The XTTS model uses the audio to clone the voice. It doesn't matter what language the sample is in, you will be able to generate speech in all supported languages, but the quality will be best if you provide a sample in your target language. You may use the sample one in the repository or upload your own. Please make sure that the audio is between 6 and 12s, mono, and the sample rate is 22050hz. You may use a tool like Audacity to prepare the files. The less noise, the better. You may use a tool like Resemble AI for denoising and/or enhancement of your samples on Hugging Face..wav
sample. However, it needs both a properly formatted .wav
file (mono, 16000hz) and a .txt
file with the transcription of what is said in the sample. The files must have the same name (apart from the extension, of course). You need to upload them to tts_voices/VoiceCraft
and you will be able to select them in the GUI. Currently only English is supported. If you generate with a new voice for the first time, the server will perform the alignment procedure, so the first sentence will be generated with a delay. This won't happen when you use that voice again.The default output format is .m4b. You can also select opus, mp3 or wav, choose a cover image and provide metadata.
Click on "Start Generation" to begin. You may stop and resume it later, or close the programme and load the session later.
You can play back the generated sentences, also as a playlist, edit them (the text that will be used for regeneration), regenerate or remove individual ones. You can also mark them for regeneration. This is useful when you don't want to stop listening but work on all problematic sentences later. You can use the "m" key to mark the sentence that is currently playing or the right mouse button to mark both the current and the previous sentence (this can be useful if you're listening to the output and not looking at the screen). "Save Output" concatenates the sentences generated so far an encodes them as one file.
Pandrator offers a comprehensive workflow for generating dubbed videos from video files or existing subtitles. This includes transcription, translation, speech generation, and synchronization:
large-v3
model provides the best results. haiku
, sonnet
, gpt-4o-mini
, gpt-4o
, deepl
, local
). With the exception of the local option, you have to set an API key in the API Keys tab. Sonnet provides the best results, but is the most expensive. You can translate 500,000 characters for free with DeepL. For local translation, you need to have Text Generation Webui set up and running with the model you want to use loaded..pth
and an .index
file. They need to have the same name (e.g. voicex.pth and voicex.index). For best results, use the same voice for XTTS. You can also fine tune the RVC options such as pitch.Contributions, suggestions for improvements, and bug reports are most welcome!
.wav
usuing Audacity, for instance..srt
subtitle files.