# jianchang512/clone-voice architecture

> Architecture diagram of the GitHub repository jianchang512/clone-voice, 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/jianchang512/clone-voice
- Repository: https://github.com/jianchang512/clone-voice

## Overview

CV声音克隆工具提供本地网页操作，将文本或输入音频与参考音色结合，生成语音或转换后的音频；README 还记录了录音、字幕导入、多语言和自定义模型训练能力。请求由 Flask 应用处理，语音任务通过队列交给模型逻辑，训练则由独立界面整理音频、生成转录数据并微调模型。源码摘录有限；图中未把未展示的页面绑定或训练内部调用补成确定关系。

Main entry points: [`app.py`](https://github.com/jianchang512/clone-voice/blob/main/app.py) (Flask 服务), [`train.py`](https://github.com/jianchang512/clone-voice/blob/main/train.py) (训练界面), [`clone/logic.py`](https://github.com/jianchang512/clone-voice/blob/main/clone/logic.py) (语音任务逻辑), [`clone/cfg.py`](https://github.com/jianchang512/clone-voice/blob/main/clone/cfg.py) (运行配置与队列)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web 操作与请求"]
  node_webui["网页界面"]
  node_flask["Flask 服务<br/>[app.py]"]
  node_customapp["定制服务<br/>[appdingzhi.py]"]
end

subgraph group_speech["语音生成与转换"]
  node_runtimecfg["运行配置与队列<br/>[cfg.py]"]
  node_speechlogic["语音任务逻辑<br/>[logic.py]"]
  node_voicefiles["参考音频"]
  node_generated["生成音频"]
  node_xtts["XTTS 模型"]
  node_ffmpeg["音频处理"]
end

subgraph group_training["模型训练"]
  node_trainerui["训练界面<br/>[train.py]"]
  node_formatter["音频整理与转录<br/>[formatter.py]"]
  node_traincfg["训练路径配置<br/>[cfg.py]"]
  node_whisper["Whisper 转录"]
  node_gpttrain["XTTS 微调"]
  node_finetuned["微调模型"]
end

node_user(("用户"))
node_audioinput["文本或音频"]

node_user -->|"操作"| node_webui
node_webui -.->|"提交请求"| node_flask
node_user -->|"提供素材"| node_audioinput
node_audioinput -->|"上传或提交"| node_flask
node_flask -->|"入队转换"| node_runtimecfg
node_speechlogic -->|"取出任务"| node_runtimecfg
node_flask -->|"保存上传"| node_voicefiles
node_speechlogic -->|"合成语音"| node_xtts
node_speechlogic -->|"写入音频"| node_generated
node_flask -->|"调整音速"| node_generated
node_flask -->|"调用处理"| node_ffmpeg
node_user -->|"整理训练素材"| node_trainerui
node_trainerui -->|"整理音频"| node_formatter
node_formatter -->|"转录语音"| node_whisper
node_trainerui -->|"读取路径"| node_traincfg
node_trainerui -->|"微调模型"| node_gpttrain
node_gpttrain -.->|"保存模型"| node_finetuned
node_customapp -->|"使用配置"| node_runtimecfg

click node_webui "https://github.com/jianchang512/clone-voice/tree/main/templates"
click node_flask "https://github.com/jianchang512/clone-voice/blob/main/app.py"
click node_customapp "https://github.com/jianchang512/clone-voice/blob/main/appdingzhi.py"
click node_runtimecfg "https://github.com/jianchang512/clone-voice/blob/main/clone/cfg.py"
click node_speechlogic "https://github.com/jianchang512/clone-voice/blob/main/clone/logic.py"
click node_voicefiles "https://github.com/jianchang512/clone-voice/tree/main/static/voicelist"
click node_generated "https://github.com/jianchang512/clone-voice/tree/main/static"
click node_xtts "https://github.com/jianchang512/clone-voice/tree/main/tts"
click node_trainerui "https://github.com/jianchang512/clone-voice/blob/main/train.py"
click node_formatter "https://github.com/jianchang512/clone-voice/blob/main/utils/formatter.py"
click node_traincfg "https://github.com/jianchang512/clone-voice/blob/main/utils/cfg.py"
click node_finetuned "https://github.com/jianchang512/clone-voice/tree/main/models/tts"

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_webui,node_flask,node_customapp toneBlue
class node_runtimecfg,node_speechlogic,node_voicefiles,node_generated,node_xtts,node_ffmpeg toneAmber
class node_trainerui,node_formatter,node_traincfg,node_whisper,node_gpttrain,node_finetuned toneMint
class node_user,node_audioinput toneIndigo
```

## Components

### Web 操作与请求

- [网页界面](https://github.com/jianchang512/clone-voice/tree/main/templates): `templates`
- [Flask 服务](https://github.com/jianchang512/clone-voice/blob/main/app.py): `app.py`
- [定制服务](https://github.com/jianchang512/clone-voice/blob/main/appdingzhi.py): `appdingzhi.py`

### 语音生成与转换

- [运行配置与队列](https://github.com/jianchang512/clone-voice/blob/main/clone/cfg.py): `clone/cfg.py`
- [语音任务逻辑](https://github.com/jianchang512/clone-voice/blob/main/clone/logic.py): `clone/logic.py`
- [参考音频](https://github.com/jianchang512/clone-voice/tree/main/static/voicelist): `static/voicelist`
- [生成音频](https://github.com/jianchang512/clone-voice/tree/main/static): `static`
- [XTTS 模型](https://github.com/jianchang512/clone-voice/tree/main/tts): `tts`
- **音频处理**

### 模型训练

- [训练界面](https://github.com/jianchang512/clone-voice/blob/main/train.py): `train.py`
- [音频整理与转录](https://github.com/jianchang512/clone-voice/blob/main/utils/formatter.py): `utils/formatter.py`
- [训练路径配置](https://github.com/jianchang512/clone-voice/blob/main/utils/cfg.py): `utils/cfg.py`
- **Whisper 转录**
- **XTTS 微调**
- [微调模型](https://github.com/jianchang512/clone-voice/tree/main/models/tts): `models/tts`

### Other components

- **用户**
- **文本或音频**

## Connections

- 用户 → 网页界面: 操作 (evidence: `README.md`)
- 网页界面 → Flask 服务: 提交请求
- 用户 → 文本或音频: 提供素材 (evidence: `README.md`)
- 文本或音频 → Flask 服务: 上传或提交 (evidence: `app.py`)
- Flask 服务 → 运行配置与队列: 入队转换 (evidence: `app.py`)
- 语音任务逻辑 → 运行配置与队列: 取出任务 (evidence: `clone/logic.py`)
- Flask 服务 → 参考音频: 保存上传 (evidence: `app.py`)
- 语音任务逻辑 → XTTS 模型: 合成语音 (evidence: `clone/logic.py`)
- 语音任务逻辑 → 生成音频: 写入音频 (evidence: `clone/logic.py`)
- Flask 服务 → 生成音频: 调整音速 (evidence: `app.py`)
- Flask 服务 → 音频处理: 调用处理 (evidence: `app.py`)
- 用户 → 训练界面: 整理训练素材 (evidence: `README.md`)
- 训练界面 → 音频整理与转录: 整理音频 (evidence: `train.py`)
- 音频整理与转录 → Whisper 转录: 转录语音 (evidence: `utils/formatter.py`)
- 训练界面 → 训练路径配置: 读取路径 (evidence: `train.py`)
- 训练界面 → XTTS 微调: 微调模型 (evidence: `train.py`)
- XTTS 微调 → 微调模型: 保存模型
- 定制服务 → 运行配置与队列: 使用配置 (evidence: `appdingzhi.py`)
