# coqui-ai/tts architecture

> Architecture diagram of the GitHub repository coqui-ai/tts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coqui-ai/tts
- Repository: https://github.com/coqui-ai/tts

## Overview

Coqui TTS is a Python text-to-speech library spanning text-to-spectrogram models, vocoders, speaker tools, voice conversion, and model-serving utilities. The main user workflow is to provide text and synthesis options through the API or server, then synthesize audio using configured models; the sampled evidence directly connects the API to the synthesizer, but does not expose every internal synthesis step. The repository also documents training, fine-tuning, and dataset curation. Several model families and training paths are represented from the tree and README, so their internal wiring is intentionally not inferred.

Main entry points: [`TTS/utils/synthesizer.py`](https://github.com/coqui-ai/tts/blob/dev/TTS/utils/synthesizer.py) (Synthesizer), [`TTS/server/server.py`](https://github.com/coqui-ai/tts/blob/dev/TTS/server/server.py) (HTTP Server), [`TTS/api.py`](https://github.com/coqui-ai/tts/blob/dev/TTS/api.py) (TTS API), [`TTS/tts/utils/speakers.py`](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/speakers.py) (Speaker Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inference["Synthesis and Serving"]
  node_api["TTS API<br/>[api.py]"]
  node_server["HTTP Server<br/>[server.py]"]
  node_synth["Synthesizer<br/>[synthesizer.py]"]
  node_synthesis["Synthesis Utilities<br/>[synthesis.py]"]
end

subgraph group_models["Speech Models"]
  node_model_registry["TTS Model Registry<br/>[__init__.py]"]
  node_spectrogram["Spectrogram Models<br/>[tacotron2.py]"]
  node_vits["VITS and YourTTS<br/>[vits.py]"]
  node_xtts["XTTS<br/>[xtts.py]"]
  node_bark["Bark Inference<br/>[inference_funcs.py]"]
  node_tortoise["Tortoise Model<br/>[tortoise.py]"]
  node_vocoder_registry["Vocoder Registry<br/>[__init__.py]"]
  node_vocoder["Vocoder Models<br/>[wavernn.py]"]
end

subgraph group_data["Text and Audio Data"]
  node_tokenizer["Text Tokenizer<br/>[tokenizer.py]"]
  node_characters["Character Sets<br/>[characters.py]"]
  node_datasets["TTS Datasets<br/>[dataset.py]"]
  node_audio["Audio Processing<br/>[processor.py]"]
end

subgraph group_speaker["Speaker and Voice"]
  node_vc_registry["Voice Conversion Registry<br/>[__init__.py]"]
  node_freevc["FreeVC<br/>[freevc.py]"]
  node_encoder["Speaker Encoder<br/>[resnet.py]"]
  node_speaker_manager["Speaker Manager<br/>[speakers.py]"]
  node_embeddings["Embedding Tool"]
end

subgraph group_resources["Configuration and Models"]
  node_config["Config Loader<br/>[__init__.py]"]
  node_model_manager["Model Manager<br/>[manage.py]"]
  node_checkpoint_io["Checkpoint I/O<br/>[io.py]"]
end

node_user(("Application User"))

node_user -->|"requests speech"| node_api
node_api -->|"calls"| node_synth
node_api -->|"manages models"| node_model_manager
node_server -->|"calls"| node_synth
node_server -->|"manages models"| node_model_manager
node_server -->|"loads config"| node_config
node_server -->|"uses I/O"| node_checkpoint_io
node_synth -->|"loads models"| node_model_registry
node_synth -->|"loads vocoders"| node_vocoder_registry
node_synth -->|"loads conversion"| node_vc_registry
node_synth -->|"uses"| node_synthesis
node_synth -->|"uses"| node_audio
node_tokenizer -->|"encodes with"| node_characters
node_embeddings -->|"loads samples"| node_datasets
node_embeddings -->|"updates embeddings"| node_speaker_manager
node_speaker_manager -->|"uses encoder helpers"| node_encoder
node_freevc -->|"uses speaker tools"| node_speaker_manager
node_config -.->|"selects config"| node_model_registry
node_model_manager -.->|"provides checkpoints"| node_checkpoint_io

click node_api "https://github.com/coqui-ai/tts/blob/dev/TTS/api.py"
click node_server "https://github.com/coqui-ai/tts/blob/dev/TTS/server/server.py"
click node_synth "https://github.com/coqui-ai/tts/blob/dev/TTS/utils/synthesizer.py"
click node_synthesis "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/synthesis.py"
click node_model_registry "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/__init__.py"
click node_spectrogram "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/tacotron2.py"
click node_vits "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/vits.py"
click node_xtts "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/xtts.py"
click node_bark "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/layers/bark/inference_funcs.py"
click node_tortoise "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/tortoise.py"
click node_vocoder_registry "https://github.com/coqui-ai/tts/blob/dev/TTS/vocoder/models/__init__.py"
click node_vocoder "https://github.com/coqui-ai/tts/blob/dev/TTS/vocoder/models/wavernn.py"
click node_vc_registry "https://github.com/coqui-ai/tts/blob/dev/TTS/vc/models/__init__.py"
click node_freevc "https://github.com/coqui-ai/tts/blob/dev/TTS/vc/models/freevc.py"
click node_encoder "https://github.com/coqui-ai/tts/blob/dev/TTS/encoder/models/resnet.py"
click node_speaker_manager "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/speakers.py"
click node_embeddings "https://github.com/coqui-ai/tts/blob/dev/TTS/bin/compute_embeddings.py"
click node_tokenizer "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/text/tokenizer.py"
click node_characters "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/text/characters.py"
click node_datasets "https://github.com/coqui-ai/tts/blob/dev/TTS/tts/datasets/dataset.py"
click node_audio "https://github.com/coqui-ai/tts/blob/dev/TTS/utils/audio/processor.py"
click node_config "https://github.com/coqui-ai/tts/blob/dev/TTS/config/__init__.py"
click node_model_manager "https://github.com/coqui-ai/tts/blob/dev/TTS/utils/manage.py"
click node_checkpoint_io "https://github.com/coqui-ai/tts/blob/dev/TTS/utils/io.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_server,node_synth,node_synthesis,node_user toneBlue
class node_model_registry,node_spectrogram,node_vits,node_xtts,node_bark,node_tortoise,node_vocoder_registry,node_vocoder toneAmber
class node_tokenizer,node_characters,node_datasets,node_audio toneMint
class node_vc_registry,node_freevc,node_encoder,node_speaker_manager,node_embeddings toneRose
class node_config,node_model_manager,node_checkpoint_io toneIndigo
```

## Components

### Synthesis and Serving

- [TTS API](https://github.com/coqui-ai/tts/blob/dev/TTS/api.py): `TTS/api.py`
- [HTTP Server](https://github.com/coqui-ai/tts/blob/dev/TTS/server/server.py): `TTS/server/server.py`
- [Synthesizer](https://github.com/coqui-ai/tts/blob/dev/TTS/utils/synthesizer.py): `TTS/utils/synthesizer.py`
- [Synthesis Utilities](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/synthesis.py): `TTS/tts/utils/synthesis.py`

### Speech Models

- [TTS Model Registry](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/__init__.py): `TTS/tts/models/__init__.py`
- [Spectrogram Models](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/tacotron2.py): `TTS/tts/models/tacotron2.py`
- [VITS and YourTTS](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/vits.py): `TTS/tts/models/vits.py`
- [XTTS](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/xtts.py): `TTS/tts/models/xtts.py`
- [Bark Inference](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/layers/bark/inference_funcs.py): `TTS/tts/layers/bark/inference_funcs.py`
- [Tortoise Model](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/models/tortoise.py): `TTS/tts/models/tortoise.py`
- [Vocoder Registry](https://github.com/coqui-ai/tts/blob/dev/TTS/vocoder/models/__init__.py): `TTS/vocoder/models/__init__.py`
- [Vocoder Models](https://github.com/coqui-ai/tts/blob/dev/TTS/vocoder/models/wavernn.py): `TTS/vocoder/models/wavernn.py`

### Text and Audio Data

- [Text Tokenizer](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/text/tokenizer.py): `TTS/tts/utils/text/tokenizer.py`
- [Character Sets](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/text/characters.py): `TTS/tts/utils/text/characters.py`
- [TTS Datasets](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/datasets/dataset.py): `TTS/tts/datasets/dataset.py`
- [Audio Processing](https://github.com/coqui-ai/tts/blob/dev/TTS/utils/audio/processor.py): `TTS/utils/audio/processor.py`

### Speaker and Voice

- [Voice Conversion Registry](https://github.com/coqui-ai/tts/blob/dev/TTS/vc/models/__init__.py): `TTS/vc/models/__init__.py`
- [FreeVC](https://github.com/coqui-ai/tts/blob/dev/TTS/vc/models/freevc.py): `TTS/vc/models/freevc.py`
- [Speaker Encoder](https://github.com/coqui-ai/tts/blob/dev/TTS/encoder/models/resnet.py): `TTS/encoder/models/resnet.py`
- [Speaker Manager](https://github.com/coqui-ai/tts/blob/dev/TTS/tts/utils/speakers.py): `TTS/tts/utils/speakers.py`
- [Embedding Tool](https://github.com/coqui-ai/tts/blob/dev/TTS/bin/compute_embeddings.py): `TTS/bin/compute_embeddings.py`

### Configuration and Models

- [Config Loader](https://github.com/coqui-ai/tts/blob/dev/TTS/config/__init__.py): `TTS/config/__init__.py`
- [Model Manager](https://github.com/coqui-ai/tts/blob/dev/TTS/utils/manage.py): `TTS/utils/manage.py`
- [Checkpoint I/O](https://github.com/coqui-ai/tts/blob/dev/TTS/utils/io.py): `TTS/utils/io.py`

### Other components

- **Application User**

## Connections

- Application User → TTS API: requests speech
- TTS API → Synthesizer: calls (evidence: `TTS/api.py`)
- TTS API → Model Manager: manages models (evidence: `TTS/api.py`)
- HTTP Server → Synthesizer: calls (evidence: `TTS/server/server.py`)
- HTTP Server → Model Manager: manages models (evidence: `TTS/server/server.py`)
- HTTP Server → Config Loader: loads config (evidence: `TTS/server/server.py`)
- HTTP Server → Checkpoint I/O: uses I/O (evidence: `TTS/server/server.py`)
- Synthesizer → TTS Model Registry: loads models (evidence: `TTS/utils/synthesizer.py`)
- Synthesizer → Vocoder Registry: loads vocoders (evidence: `TTS/utils/synthesizer.py`)
- Synthesizer → Voice Conversion Registry: loads conversion (evidence: `TTS/utils/synthesizer.py`)
- Synthesizer → Synthesis Utilities: uses (evidence: `TTS/utils/synthesizer.py`)
- Synthesizer → Audio Processing: uses (evidence: `TTS/utils/synthesizer.py`)
- Text Tokenizer → Character Sets: encodes with (evidence: `TTS/tts/utils/text/tokenizer.py`)
- Embedding Tool → TTS Datasets: loads samples (evidence: `TTS/bin/compute_embeddings.py`)
- Embedding Tool → Speaker Manager: updates embeddings (evidence: `TTS/bin/compute_embeddings.py`)
- Speaker Manager → Speaker Encoder: uses encoder helpers
- FreeVC → Speaker Manager: uses speaker tools (evidence: `TTS/vc/models/freevc.py`)
- Config Loader → TTS Model Registry: selects config
- Model Manager → Checkpoint I/O: provides checkpoints
