Skip to content

Repository files navigation

Gregg 🗣️🇬🇧

Scottish AI Voice Model — TTS Fine-tuning Project

Welcome to Gregg, a voice cloning project using AI to train a custom Scottish accent voice (nicknamed “Greg”). This repository uses Tacotron2 for spectrogram generation and HiFi-GAN for waveform synthesis to create high-quality, expressive speech from text.


🎯 Project Goals

  • Train a natural-sounding voice model for “Greg” (Scottish accent)
  • Use open-source tools for fine-tuning on a small custom dataset
  • Experiment with phoneme settings, audio quality, and inference improvements

🛠️ Core Features

  • Tacotron2 + HiFi-GAN: Neural TTS stack for clear speech synthesis
  • LJSpeech-compatible Formatting: Flexible with metadata.csv
  • Custom Voice Training: Easily fine-tune using your own recordings
  • Configurable Output: Adjust all model, training, and audio parameters via config.json
  • Test Sentences: Quickly generate inference output from predefined sentences
  • Supports English Phonemizer: For improved pronunciation control

📦 Requirements

  • Python 3.7+
  • PyTorch with GPU support recommended
  • FFmpeg installed and accessible in PATH

Install dependencies:

pip install -r requirements.txt

⚙️ Configuration

Example config.json snippet:

{
  "model": "Tacotron2",
  "generator_model": "HiFi-GAN",
  "audio_config": {
    "sample_rate": 22050,
    "fft_size": 1024,
    "hop_length": 256
  },
  "training_config": {
    "epochs": 100,
    "batch_size": 16,
    "learning_rate": 0.001
  },
  "datasets": [
    {
      "formatter": "ljspeech",
      "path": "dataset/",
      "meta_file_train": "metadata.csv",
      "language": "English",
      "phonemizer": "English"
    }
  ]
}

💡 Important: Make sure the "language" is explicitly set to "English" — the model will error out otherwise.


🧪 Usage

🔊 Generate Speech

python main.py

This will generate a sample file like:

output/test-output.wav

🗣️ Clone a Voice with XTTS

If you simply want to synthesise speech in your own voice without retraining the model, you can leverage the pretrained XTTS v2 model. Provide a short reference audio clip of yourself and the text you would like the model to speak:

python synth_xtts.py --text "Hello from Scotland" --speaker_wav path/to/your_voice.wav --output output/greg.wav

This uses the default tts_models/multilingual/multi-dataset/xtts_v2 checkpoint shipped with Coqui TTS to generate an audio file in output/greg.wav.


🧬 Train / Fine-Tune Model

python train_tts.py --config_path config.json --output_path output/

Training progress is saved to:

output/checkpoints/
output/logs/

You can resume training with:

python train_tts.py --config_path config.json --continue_path output/

📁 Project Structure

greg-ai/
├── config.json           # Main configuration
├── main.py               # Synthesis entry point
├── train_tts.py          # Training script
├── dataset/              # Custom audio and metadata
│   ├── metadata.csv
│   └── wavs/
├── output/               # Checkpoints, logs, generated audio
├── .venv/                # Python virtual environment

🗃️ Dataset Format

The dataset folder should follow this format:

dataset/
├── metadata.csv    # Format: filename|transcript
├── wavs/
│   ├── clip1.wav
│   ├── clip2.wav
  • All audio files must be mono WAV format
  • Use a sample rate of 22050 Hz
  • Match filenames exactly to metadata.csv entries

🐞 Troubleshooting

ValueError: The dataset language must be set to 'English'

Ensure that "language": "English" is set in the config and dataset section. Also make sure the phonemizer is valid for English or left out if unused.


🙌 Credits


📄 License

MIT — free to use, modify, and share. See LICENSE file for details.


💬 Contact

Built by Adamadam@ajstudios.dev
Project repo: github.com/uxillary/greg-ai


🚧 Future Plans

  • XTTS v2 support for multi-speaker synthesis
  • Dataset augmentation via phoneme control
  • Real-time inference UI using Streamlit or Gradio
  • Voice personality tuning and expression embedding

About

Ai voice model training for "Greg" Scottish AI

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages