With this tool you can create custom TTS dataset from video or audio.
16
stars
18
commits
Python
primary language
Jun 7, 2025
updated
A powerful tool for generating high-quality text-to-speech (TTS) datasets from audio or video files. This utility automates the process of segmenting media files into optimal chunks and transcribing them accurately, saving hours of manual work.
This tool helps you:
Perfect for creating custom voice datasets, podcast transcription, lecture processing, and more.
Requires the command-line tool ffmpeg to be installed on your system, which is available from most package managers:
# on Ubuntu or Debian
sudo apt update && sudo apt install ffmpeg
# on Arch Linux
sudo pacman -S ffmpeg
# on MacOS using Homebrew (https://brew.sh/)
brew install ffmpeg
# on Windows using Chocolatey (https://chocolatey.org/)
choco install ffmpeg
# on Windows using Scoop (https://scoop.sh/)
scoop install ffmpeg
# Clone this repository
git clone https://github.com/gokhaneraslan/tts-dataset-generator.git
cd tts-dataset-generator
# Install dependencies
pip install -r requirements.txt
The main dependencies include:
To choose the best model for your system, please visit for available models and required VRAM information.
OpenAI Whisper
If you do not have enough equipment to choose the "large" whisper model, we recommend you to use google colab.
python main.py --file your_audio_or_video_file.mp4 --model large --language tr
# Or
python main.py --f your_audio_or_video_file.mp4 -m small -l tr
This will:
MyTTSDataset/wavs/MyTTSDataset/metadata.csvpython main.py \
--file your_file.mp4 \
--min-duration 3.0 \
--max-duration 8.0 \
--silence-threshold -35 \
--min-silence-len 500 \
--keep-silence 100 \
--model medium \
--language tr \
--ljspeech True \
--sample_rate 22050
| Parameter | Description | Default |
|---|---|---|
--file or -f | Input audio or video file path | (Required) |
--min-duration | Minimum segment duration in seconds | 3.0 |
--max-duration | Maximum segment duration in seconds | 10.0 |
--silence-threshold | Audio level (dBFS) below which is considered silence | -40 |
--min-silence-len | Minimum silence duration (ms) to mark a split point | 250 |
--keep-silence | Padding silence (ms) to keep at segment boundaries | 150 |
--model or -m | Whisper model size (tiny/base/small/medium/large) | large |
--language or -l | Language code for transcription and number conversion | en |
--ljspeech | Dataset format for coqui-ai/TTS formatter ljspeech | True |
--sample_rate | Must be the same as the sampling rate of the sounds in the dataset | 22050 |
--log-level | Set logging level (DEBUG/INFO/WARNING/ERROR/CRITICAL) | INFO |
The tool supports multiple languages through the Whisper model. Some commonly used language codes:
tr - Turkishen - Englishfr - Frenchde - Germanes - Spanishit - Italianja - Japanesezh - Chineseru - Russianpt - PortugueseRun the tool to see a complete list of supported language codes.
The tool uses a sophisticated audio segmentation approach optimized for TTS dataset creation:
Silence Detection:
split_on_silence function which analyzes the audio waveform to identify natural pauses in speechsilence_thresh_dbfs parameter (-40 dBFS by default) determines what volume level is considered silencemin_silence_len_ms parameter (250ms by default) sets how long a silence must be to trigger a splitDuration Constraints:
min_duration_s and max_duration_s secondsNatural Boundaries:
keep_silence_ms) at the beginning/end of each segmentPadding:
For optimal results:
silence_thresh_dbfs values (-45 to -50)min_silence_len_ms to catch shorter pausesmin_silence_len_msThe transcription uses OpenAI's Whisper, a state-of-the-art speech recognition model:
This tool generates datasets compatible with most modern TTS frameworks. Here's how it fits into typical TTS training workflows:
The generated dataset works seamlessly with:
Traditional TTS Models:
Modern Neural TTS Frameworks:
The generated metadata.csv follows the LJSpeech format widely used in TTS training:
--ljspeech True
segment_1|The quick brown fox jumps over the lazy dog.|The quick brown fox jumps over the lazy dog.
segment_2|She sells seashells by the seashore.|She sells seashells by the seashore.
--ljspeech False
wavs/segment_1.wav|The quick brown fox jumps over the lazy dog.
wavs/segment_2.wav|She sells seashells by the seashore.
This format is supported by most TTS frameworks out-of-the-box or with minimal adaptation.
For Coqui TTS:
# Train a Tacotron2 model using our generated dataset
tts train --config_path config.json --coqpit.datasets.0.path ./MyTTSDataset
For VITS:
# Modify VITS config to point to our dataset
sed -i 's|"training_files":.*|"training_files":"./MyTTSDataset/metadata.csv",|g' configs/vits.json
# Start training
python train.py -c configs/vits.json -m vits
Let's walk through a complete example:
python main.py --file interview.mp4 --model medium --language en
Examine the output:
MyTTSDataset/wavs/MyTTSDataset/metadata.csvFormat of ljspeech metadata.csv: wav_filename|text|normalized_text or text
segment_1|Hello and welcome to our tutorial on text to speech.|Hello and welcome to our tutorial on text to speech.
segment_2|Today we'll learn how to create high quality voice datasets.|Today we'll learn how to create high quality voice datasets.
segment_3|The first step is to record clear audio samples.|The first step is to record clear audio samples.
wavs/segment_1.wav|Hello and welcome to our tutorial on text to speech.
wavs/segment_2.wav|Today we'll learn how to create high quality voice datasets.
wavs/segment_3.wav|The first step is to record clear audio samples.
large model (requires more RAM/VRAM)small or base modelssilence-threshold parameter if your audio has background noiseFor optimal TTS training results:
Recording Quality:
Speech Characteristics:
Dataset Composition:
Contributions are welcome! Please feel free to submit a Pull Request.
18 commits
Python
92.9%
Jupyter Notebook
7.1%
With this tool you can create custom TTS dataset from video or audio.
16
stars
18
commits
Python
primary language
Jun 7, 2025
updated
A powerful tool for generating high-quality text-to-speech (TTS) datasets from audio or video files. This utility automates the process of segmenting media files into optimal chunks and transcribing them accurately, saving hours of manual work.
This tool helps you:
Perfect for creating custom voice datasets, podcast transcription, lecture processing, and more.
Requires the command-line tool ffmpeg to be installed on your system, which is available from most package managers:
# on Ubuntu or Debian
sudo apt update && sudo apt install ffmpeg
# on Arch Linux
sudo pacman -S ffmpeg
# on MacOS using Homebrew (https://brew.sh/)
brew install ffmpeg
# on Windows using Chocolatey (https://chocolatey.org/)
choco install ffmpeg
# on Windows using Scoop (https://scoop.sh/)
scoop install ffmpeg
# Clone this repository
git clone https://github.com/gokhaneraslan/tts-dataset-generator.git
cd tts-dataset-generator
# Install dependencies
pip install -r requirements.txt
The main dependencies include:
To choose the best model for your system, please visit for available models and required VRAM information.
OpenAI Whisper
If you do not have enough equipment to choose the "large" whisper model, we recommend you to use google colab.
python main.py --file your_audio_or_video_file.mp4 --model large --language tr
# Or
python main.py --f your_audio_or_video_file.mp4 -m small -l tr
This will:
MyTTSDataset/wavs/MyTTSDataset/metadata.csvpython main.py \
--file your_file.mp4 \
--min-duration 3.0 \
--max-duration 8.0 \
--silence-threshold -35 \
--min-silence-len 500 \
--keep-silence 100 \
--model medium \
--language tr \
--ljspeech True \
--sample_rate 22050
| Parameter | Description | Default |
|---|---|---|
--file or -f | Input audio or video file path | (Required) |
--min-duration | Minimum segment duration in seconds | 3.0 |
--max-duration | Maximum segment duration in seconds | 10.0 |
--silence-threshold | Audio level (dBFS) below which is considered silence | -40 |
--min-silence-len | Minimum silence duration (ms) to mark a split point | 250 |
--keep-silence | Padding silence (ms) to keep at segment boundaries | 150 |
--model or -m | Whisper model size (tiny/base/small/medium/large) | large |
--language or -l | Language code for transcription and number conversion | en |
--ljspeech | Dataset format for coqui-ai/TTS formatter ljspeech | True |
--sample_rate | Must be the same as the sampling rate of the sounds in the dataset | 22050 |
--log-level | Set logging level (DEBUG/INFO/WARNING/ERROR/CRITICAL) | INFO |
The tool supports multiple languages through the Whisper model. Some commonly used language codes:
tr - Turkishen - Englishfr - Frenchde - Germanes - Spanishit - Italianja - Japanesezh - Chineseru - Russianpt - PortugueseRun the tool to see a complete list of supported language codes.
The tool uses a sophisticated audio segmentation approach optimized for TTS dataset creation:
Silence Detection:
split_on_silence function which analyzes the audio waveform to identify natural pauses in speechsilence_thresh_dbfs parameter (-40 dBFS by default) determines what volume level is considered silencemin_silence_len_ms parameter (250ms by default) sets how long a silence must be to trigger a splitDuration Constraints:
min_duration_s and max_duration_s secondsNatural Boundaries:
keep_silence_ms) at the beginning/end of each segmentPadding:
For optimal results:
silence_thresh_dbfs values (-45 to -50)min_silence_len_ms to catch shorter pausesmin_silence_len_msThe transcription uses OpenAI's Whisper, a state-of-the-art speech recognition model:
This tool generates datasets compatible with most modern TTS frameworks. Here's how it fits into typical TTS training workflows:
The generated dataset works seamlessly with:
Traditional TTS Models:
Modern Neural TTS Frameworks:
The generated metadata.csv follows the LJSpeech format widely used in TTS training:
--ljspeech True
segment_1|The quick brown fox jumps over the lazy dog.|The quick brown fox jumps over the lazy dog.
segment_2|She sells seashells by the seashore.|She sells seashells by the seashore.
--ljspeech False
wavs/segment_1.wav|The quick brown fox jumps over the lazy dog.
wavs/segment_2.wav|She sells seashells by the seashore.
This format is supported by most TTS frameworks out-of-the-box or with minimal adaptation.
For Coqui TTS:
# Train a Tacotron2 model using our generated dataset
tts train --config_path config.json --coqpit.datasets.0.path ./MyTTSDataset
For VITS:
# Modify VITS config to point to our dataset
sed -i 's|"training_files":.*|"training_files":"./MyTTSDataset/metadata.csv",|g' configs/vits.json
# Start training
python train.py -c configs/vits.json -m vits
Let's walk through a complete example:
python main.py --file interview.mp4 --model medium --language en
Examine the output:
MyTTSDataset/wavs/MyTTSDataset/metadata.csvFormat of ljspeech metadata.csv: wav_filename|text|normalized_text or text
segment_1|Hello and welcome to our tutorial on text to speech.|Hello and welcome to our tutorial on text to speech.
segment_2|Today we'll learn how to create high quality voice datasets.|Today we'll learn how to create high quality voice datasets.
segment_3|The first step is to record clear audio samples.|The first step is to record clear audio samples.
wavs/segment_1.wav|Hello and welcome to our tutorial on text to speech.
wavs/segment_2.wav|Today we'll learn how to create high quality voice datasets.
wavs/segment_3.wav|The first step is to record clear audio samples.
large model (requires more RAM/VRAM)small or base modelssilence-threshold parameter if your audio has background noiseFor optimal TTS training results:
Recording Quality:
Speech Characteristics:
Dataset Composition:
Contributions are welcome! Please feel free to submit a Pull Request.
18 commits
Python
92.9%
Jupyter Notebook
7.1%