# myshell-ai/openvoice architecture

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

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

## Overview

OpenVoice is a voice-cloning and speech-generation system. Its user-facing workflow accepts text and speaker/reference audio, prepares text and speaker representations, synthesizes speech or converts voice tone, and returns audio. The README also describes multilingual and voice-style capabilities; the sampled API directly exposes English/Chinese TTS and tone-color conversion, while the app and extractor provide the broader interface. The graph includes the model and text-processing layers; some internal app wiring and unsampled capabilities are shown only where documented or indexed.

Main entry points: [`openvoice/api.py`](https://github.com/myshell-ai/openvoice/blob/main/openvoice/api.py) (Text-to-Speech), [`openvoice/models.py`](https://github.com/myshell-ai/openvoice/blob/main/openvoice/models.py) (Synthesizer Model), [`openvoice/openvoice_app.py`](https://github.com/myshell-ai/openvoice/blob/main/openvoice/openvoice_app.py) (Demo App), [`openvoice/text/__init__.py`](https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/__init__.py) (Text Sequencing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_app["Demo App<br/>[openvoice_app.py]"]
end

subgraph group_speech["Speech Workflows"]
  node_extractor["Speaker Extractor<br/>[se_extractor.py]"]
  node_tts["Text-to-Speech<br/>[api.py]"]
  node_converter["Tone Converter<br/>[api.py]"]
  node_audio["Generated Audio"]
  node_utils["Runtime Utilities<br/>[utils.py]"]
end

subgraph group_text["Text Processing"]
  node_textseq["Text Sequencing<br/>[__init__.py]"]
  node_cleaners["Text Cleaners<br/>[cleaners.py]"]
  node_english["English Phonemes<br/>[english.py]"]
  node_mandarin["Chinese Phonemes<br/>[mandarin.py]"]
  node_symbols["Speech Symbols<br/>[symbols.py]"]
end

subgraph group_model["Model Internals"]
  node_synth["Synthesizer Model<br/>[models.py]"]
  node_attention["Attention Layers<br/>[attentions.py]"]
  node_modules["Flow Modules<br/>[modules.py]"]
  node_transforms["Spline Transforms<br/>[transforms.py]"]
  node_commons["Model Utilities<br/>[commons.py]"]
  node_mel["Spectrogram Processing<br/>[mel_processing.py]"]
end

node_user(("User"))

node_user -->|"provides input"| node_app
node_app -->|"invokes synthesis"| node_tts
node_app -->|"invokes conversion"| node_converter
node_app -->|"extracts speaker"| node_extractor
node_tts -->|"encodes text"| node_textseq
node_tts -->|"runs model"| node_synth
node_tts -->|"splits sentences"| node_utils
node_tts -->|"writes speech"| node_audio
node_converter -->|"runs conversion"| node_synth
node_converter -->|"processes audio"| node_mel
node_converter -->|"writes converted audio"| node_audio
node_textseq -->|"cleans text"| node_cleaners
node_textseq -->|"maps symbols"| node_symbols
node_cleaners -->|"normalizes English"| node_english
node_cleaners -->|"normalizes Chinese"| node_mandarin
node_synth -->|"uses attention"| node_attention
node_synth -->|"uses flow layers"| node_modules
node_modules -->|"uses splines"| node_transforms
node_modules -->|"uses attention"| node_attention
node_attention -->|"uses helpers"| node_commons
node_synth -->|"uses helpers"| node_commons

click node_app "https://github.com/myshell-ai/openvoice/blob/main/openvoice/openvoice_app.py"
click node_extractor "https://github.com/myshell-ai/openvoice/blob/main/openvoice/se_extractor.py"
click node_tts "https://github.com/myshell-ai/openvoice/blob/main/openvoice/api.py"
click node_converter "https://github.com/myshell-ai/openvoice/blob/main/openvoice/api.py"
click node_textseq "https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/__init__.py"
click node_cleaners "https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/cleaners.py"
click node_english "https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/english.py"
click node_mandarin "https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/mandarin.py"
click node_symbols "https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/symbols.py"
click node_synth "https://github.com/myshell-ai/openvoice/blob/main/openvoice/models.py"
click node_attention "https://github.com/myshell-ai/openvoice/blob/main/openvoice/attentions.py"
click node_modules "https://github.com/myshell-ai/openvoice/blob/main/openvoice/modules.py"
click node_transforms "https://github.com/myshell-ai/openvoice/blob/main/openvoice/transforms.py"
click node_commons "https://github.com/myshell-ai/openvoice/blob/main/openvoice/commons.py"
click node_mel "https://github.com/myshell-ai/openvoice/blob/main/openvoice/mel_processing.py"
click node_utils "https://github.com/myshell-ai/openvoice/blob/main/openvoice/utils.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_app,node_user toneBlue
class node_extractor,node_tts,node_converter,node_audio,node_utils toneAmber
class node_textseq,node_cleaners,node_english,node_mandarin,node_symbols toneMint
class node_synth,node_attention,node_modules,node_transforms,node_commons,node_mel toneRose
```

## Components

### User Interface

- [Demo App](https://github.com/myshell-ai/openvoice/blob/main/openvoice/openvoice_app.py): `openvoice/openvoice_app.py`

### Speech Workflows

- [Speaker Extractor](https://github.com/myshell-ai/openvoice/blob/main/openvoice/se_extractor.py): `openvoice/se_extractor.py`
- [Text-to-Speech](https://github.com/myshell-ai/openvoice/blob/main/openvoice/api.py): `openvoice/api.py`
- [Tone Converter](https://github.com/myshell-ai/openvoice/blob/main/openvoice/api.py): `openvoice/api.py`
- **Generated Audio**
- [Runtime Utilities](https://github.com/myshell-ai/openvoice/blob/main/openvoice/utils.py): `openvoice/utils.py`

### Text Processing

- [Text Sequencing](https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/__init__.py): `openvoice/text/__init__.py`
- [Text Cleaners](https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/cleaners.py): `openvoice/text/cleaners.py`
- [English Phonemes](https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/english.py): `openvoice/text/english.py`
- [Chinese Phonemes](https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/mandarin.py): `openvoice/text/mandarin.py`
- [Speech Symbols](https://github.com/myshell-ai/openvoice/blob/main/openvoice/text/symbols.py): `openvoice/text/symbols.py`

### Model Internals

- [Synthesizer Model](https://github.com/myshell-ai/openvoice/blob/main/openvoice/models.py): `openvoice/models.py`
- [Attention Layers](https://github.com/myshell-ai/openvoice/blob/main/openvoice/attentions.py): `openvoice/attentions.py`
- [Flow Modules](https://github.com/myshell-ai/openvoice/blob/main/openvoice/modules.py): `openvoice/modules.py`
- [Spline Transforms](https://github.com/myshell-ai/openvoice/blob/main/openvoice/transforms.py): `openvoice/transforms.py`
- [Model Utilities](https://github.com/myshell-ai/openvoice/blob/main/openvoice/commons.py): `openvoice/commons.py`
- [Spectrogram Processing](https://github.com/myshell-ai/openvoice/blob/main/openvoice/mel_processing.py): `openvoice/mel_processing.py`

### Other components

- **User**

## Connections

- User → Demo App: provides input (evidence: `README.md`)
- Demo App → Text-to-Speech: invokes synthesis (evidence: `openvoice/openvoice_app.py`)
- Demo App → Tone Converter: invokes conversion (evidence: `openvoice/openvoice_app.py`)
- Demo App → Speaker Extractor: extracts speaker (evidence: `openvoice/openvoice_app.py`)
- Text-to-Speech → Text Sequencing: encodes text (evidence: `openvoice/api.py`)
- Text-to-Speech → Synthesizer Model: runs model (evidence: `openvoice/api.py`)
- Text-to-Speech → Runtime Utilities: splits sentences (evidence: `openvoice/api.py`)
- Text-to-Speech → Generated Audio: writes speech (evidence: `openvoice/api.py`)
- Tone Converter → Synthesizer Model: runs conversion (evidence: `openvoice/api.py`)
- Tone Converter → Spectrogram Processing: processes audio (evidence: `openvoice/api.py`)
- Tone Converter → Generated Audio: writes converted audio (evidence: `openvoice/api.py`)
- Text Sequencing → Text Cleaners: cleans text (evidence: `openvoice/text/__init__.py`)
- Text Sequencing → Speech Symbols: maps symbols (evidence: `openvoice/text/__init__.py`)
- Text Cleaners → English Phonemes: normalizes English (evidence: `openvoice/text/cleaners.py`)
- Text Cleaners → Chinese Phonemes: normalizes Chinese (evidence: `openvoice/text/cleaners.py`)
- Synthesizer Model → Attention Layers: uses attention (evidence: `openvoice/models.py`)
- Synthesizer Model → Flow Modules: uses flow layers (evidence: `openvoice/models.py`)
- Flow Modules → Spline Transforms: uses splines (evidence: `openvoice/modules.py`)
- Flow Modules → Attention Layers: uses attention (evidence: `openvoice/modules.py`)
- Attention Layers → Model Utilities: uses helpers (evidence: `openvoice/attentions.py`)
- Synthesizer Model → Model Utilities: uses helpers (evidence: `openvoice/models.py`)
