# amp2byte/openvoice architecture

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

- Interactive diagram: https://gitdiagram.com/amp2byte/openvoice
- Repository: https://github.com/amp2byte/openvoice

## Overview

OpenVoice is a voice-cloning and speech-generation package. The principal workflow is a user submitting text and a target voice, the app obtaining speaker characteristics from reference audio, and the API synthesizing speech and optionally converting tone color and watermarking audio. The repository also documents multilingual support and flexible voice-style control. Source excerpts show the API, text processing, and model internals; app and speaker-extraction links are limited to references in the source index, so the graph avoids guessing their detailed call sequence.

Main entry points: [`openvoice/api.py`](https://github.com/amp2byte/openvoice/blob/main/openvoice/api.py) (Voice API), [`openvoice/openvoice_app.py`](https://github.com/amp2byte/openvoice/blob/main/openvoice/openvoice_app.py) (Gradio app), [`openvoice/models.py`](https://github.com/amp2byte/openvoice/blob/main/openvoice/models.py) (Synthesizer), [`openvoice/modules.py`](https://github.com/amp2byte/openvoice/blob/main/openvoice/modules.py) (Neural modules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_appui["Gradio app<br/>[openvoice_app.py]"]
end

subgraph group_voice["Voice processing"]
  node_extractor["Speaker extraction<br/>[se_extractor.py]"]
  node_api["Voice API<br/>[api.py]"]
  node_watermark["Watermarking<br/>[api.py]"]
end

subgraph group_text["Text processing"]
  node_language["Language conversion<br/>[english.py]"]
  node_mandarin["Mandarin conversion<br/>[mandarin.py]"]
  node_cleaners["Text cleaners<br/>[cleaners.py]"]
  node_sequence["Phone sequences<br/>[__init__.py]"]
  node_symbols["Phone symbols<br/>[symbols.py]"]
end

subgraph group_model["Synthesis model"]
  node_synth["Synthesizer<br/>[models.py]"]
  node_attention["Attention layers<br/>[attentions.py]"]
  node_neuralmodules["Neural modules<br/>[modules.py]"]
  node_transforms["Spline transforms<br/>[transforms.py]"]
  node_commons["Model utilities<br/>[commons.py]"]
  node_mel["Mel processing<br/>[mel_processing.py]"]
end

node_user(("User"))
node_reference["Reference audio"]
node_audio["Generated audio"]
node_textinput["Text input"]

node_user -->|"submits request"| node_appui
node_reference -->|"provides voice"| node_appui
node_textinput -->|"provides text"| node_appui
node_appui -->|"uses API"| node_api
node_appui -->|"uses extractor"| node_extractor
node_api -->|"encodes text"| node_sequence
node_sequence -->|"cleans text"| node_cleaners
node_sequence -->|"maps symbols"| node_symbols
node_cleaners -->|"converts English"| node_language
node_cleaners -->|"converts Chinese"| node_mandarin
node_api -->|"runs synthesis"| node_synth
node_api -->|"processes spectrogram"| node_mel
node_synth -->|"uses utilities"| node_commons
node_synth -->|"uses layers"| node_neuralmodules
node_synth -->|"uses attention"| node_attention
node_neuralmodules -->|"uses utilities"| node_commons
node_neuralmodules -->|"uses splines"| node_transforms
node_neuralmodules -->|"uses attention"| node_attention
node_attention -->|"uses utilities"| node_commons
node_api -->|"adds watermark"| node_watermark
node_api -->|"writes audio"| node_audio
node_reference -.->|"extracts speaker"| node_extractor
node_extractor -.->|"provides speaker embedding"| node_api

click node_appui "https://github.com/amp2byte/openvoice/blob/main/openvoice/openvoice_app.py"
click node_extractor "https://github.com/amp2byte/openvoice/blob/main/openvoice/se_extractor.py"
click node_api "https://github.com/amp2byte/openvoice/blob/main/openvoice/api.py"
click node_watermark "https://github.com/amp2byte/openvoice/blob/main/openvoice/api.py"
click node_language "https://github.com/amp2byte/openvoice/blob/main/openvoice/text/english.py"
click node_mandarin "https://github.com/amp2byte/openvoice/blob/main/openvoice/text/mandarin.py"
click node_cleaners "https://github.com/amp2byte/openvoice/blob/main/openvoice/text/cleaners.py"
click node_sequence "https://github.com/amp2byte/openvoice/blob/main/openvoice/text/__init__.py"
click node_symbols "https://github.com/amp2byte/openvoice/blob/main/openvoice/text/symbols.py"
click node_synth "https://github.com/amp2byte/openvoice/blob/main/openvoice/models.py"
click node_attention "https://github.com/amp2byte/openvoice/blob/main/openvoice/attentions.py"
click node_neuralmodules "https://github.com/amp2byte/openvoice/blob/main/openvoice/modules.py"
click node_transforms "https://github.com/amp2byte/openvoice/blob/main/openvoice/transforms.py"
click node_commons "https://github.com/amp2byte/openvoice/blob/main/openvoice/commons.py"
click node_mel "https://github.com/amp2byte/openvoice/blob/main/openvoice/mel_processing.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_appui,node_user toneBlue
class node_extractor,node_api,node_watermark toneAmber
class node_language,node_mandarin,node_cleaners,node_sequence,node_symbols toneMint
class node_synth,node_attention,node_neuralmodules,node_transforms,node_commons,node_mel toneRose
class node_reference,node_audio,node_textinput toneIndigo
```

## Components

### Application

- [Gradio app](https://github.com/amp2byte/openvoice/blob/main/openvoice/openvoice_app.py): `openvoice/openvoice_app.py`

### Voice processing

- [Speaker extraction](https://github.com/amp2byte/openvoice/blob/main/openvoice/se_extractor.py): `openvoice/se_extractor.py`
- [Voice API](https://github.com/amp2byte/openvoice/blob/main/openvoice/api.py): `openvoice/api.py`
- [Watermarking](https://github.com/amp2byte/openvoice/blob/main/openvoice/api.py): `openvoice/api.py`

### Text processing

- [Language conversion](https://github.com/amp2byte/openvoice/blob/main/openvoice/text/english.py): `openvoice/text/english.py`
- [Mandarin conversion](https://github.com/amp2byte/openvoice/blob/main/openvoice/text/mandarin.py): `openvoice/text/mandarin.py`
- [Text cleaners](https://github.com/amp2byte/openvoice/blob/main/openvoice/text/cleaners.py): `openvoice/text/cleaners.py`
- [Phone sequences](https://github.com/amp2byte/openvoice/blob/main/openvoice/text/__init__.py): `openvoice/text/__init__.py`
- [Phone symbols](https://github.com/amp2byte/openvoice/blob/main/openvoice/text/symbols.py): `openvoice/text/symbols.py`

### Synthesis model

- [Synthesizer](https://github.com/amp2byte/openvoice/blob/main/openvoice/models.py): `openvoice/models.py`
- [Attention layers](https://github.com/amp2byte/openvoice/blob/main/openvoice/attentions.py): `openvoice/attentions.py`
- [Neural modules](https://github.com/amp2byte/openvoice/blob/main/openvoice/modules.py): `openvoice/modules.py`
- [Spline transforms](https://github.com/amp2byte/openvoice/blob/main/openvoice/transforms.py): `openvoice/transforms.py`
- [Model utilities](https://github.com/amp2byte/openvoice/blob/main/openvoice/commons.py): `openvoice/commons.py`
- [Mel processing](https://github.com/amp2byte/openvoice/blob/main/openvoice/mel_processing.py): `openvoice/mel_processing.py`

### Other components

- **User**
- **Reference audio**
- **Generated audio**
- **Text input**

## Connections

- User → Gradio app: submits request (evidence: `README.md`)
- Reference audio → Gradio app: provides voice (evidence: `README.md`)
- Text input → Gradio app: provides text (evidence: `README.md`)
- Gradio app → Voice API: uses API (evidence: `openvoice/openvoice_app.py`)
- Gradio app → Speaker extraction: uses extractor (evidence: `openvoice/openvoice_app.py`)
- Voice API → Phone sequences: encodes text (evidence: `openvoice/api.py`)
- Phone sequences → Text cleaners: cleans text (evidence: `openvoice/text/__init__.py`)
- Phone sequences → Phone symbols: maps symbols (evidence: `openvoice/text/__init__.py`)
- Text cleaners → Language conversion: converts English (evidence: `openvoice/text/cleaners.py`)
- Text cleaners → Mandarin conversion: converts Chinese (evidence: `openvoice/text/cleaners.py`)
- Voice API → Synthesizer: runs synthesis (evidence: `openvoice/api.py`)
- Voice API → Mel processing: processes spectrogram (evidence: `openvoice/api.py`)
- Synthesizer → Model utilities: uses utilities (evidence: `openvoice/models.py`)
- Synthesizer → Neural modules: uses layers (evidence: `openvoice/models.py`)
- Synthesizer → Attention layers: uses attention (evidence: `openvoice/models.py`)
- Neural modules → Model utilities: uses utilities (evidence: `openvoice/modules.py`)
- Neural modules → Spline transforms: uses splines (evidence: `openvoice/modules.py`)
- Neural modules → Attention layers: uses attention (evidence: `openvoice/modules.py`)
- Attention layers → Model utilities: uses utilities (evidence: `openvoice/attentions.py`)
- Voice API → Watermarking: adds watermark (evidence: `openvoice/api.py`)
- Voice API → Generated audio: writes audio (evidence: `openvoice/api.py`)
- Reference audio → Speaker extraction: extracts speaker
- Speaker extraction → Voice API: provides speaker embedding
