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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# MoYoYo.tts Usage Manual

## Table of Contents

- [Introduction](#introduction)
- [System Requirements](#system-requirements)
- [Installation Guide](#installation-guide)
  - [Install uv Package Manager](#31-install-uv-package-manager)
  - [Python Environment Setup](#32-python-environment-setup)
  - [Download Required Data Files](#33-download-required-data-files)
  - [Frontend Setup](#34-frontend-setup)
- [Configuration](#configuration)
  - [Backend API Configuration](#41-backend-api-configuration)
  - [Frontend Configuration](#42-frontend-configuration)
- [Running the Application](#running-the-application)
  - [Start Backend API Server](#51-start-backend-api-server)
  - [Start Frontend Electron App](#52-start-frontend-electron-app)
- [First-Time Setup](#first-time-setup)
- [Feature Overview](#feature-overview)
- [Troubleshooting](#troubleshooting)

---

## Introduction

MoYoYo.tts is a comprehensive voice cloning and text-to-speech system that combines:

- **Backend API**: FastAPI-based REST API for voice training and inference
- **Frontend Application**: Electron + Vue desktop app with intuitive UI

The system is built on GPT-SoVITS technology, enabling high-quality voice cloning with minimal training data (as little as 5 seconds of audio).

**Target Audience**:
- End users who want to create custom voices for text-to-speech
- Developers integrating voice synthesis into applications
- Researchers experimenting with voice cloning technology

**Key Features**:
- Quick Mode: One-click voice cloning for beginners
- Advanced Mode: Fine-grained control over training pipeline
- Real-time progress tracking via Server-Sent Events (SSE)
- Multi-language support (Chinese, English, Japanese)
- GPU acceleration with CUDA support

---

## System Requirements

### Software Requirements

| Component | Version | Notes |
|-----------|---------|-------|
| **Python** | 3.10 - 3.12 | Python 3.11 recommended |
| **Node.js** | >= 18.x | For frontend development |
| **uv** | Latest | Python package manager |
| **CUDA** | 12.6 or 12.8 | Optional, for GPU acceleration |

### Hardware Requirements

| Component | Minimum | Recommended |
|-----------|---------|-------------|
| **CPU** | Dual-core | Quad-core or better |
| **RAM** | 16 GB | 32 GB (for training) |
| **GPU** | None (CPU mode) | NVIDIA GPU with 6GB+ VRAM |
| **Storage** | 20 GB free | 50 GB+ for multiple voices |

**GPU Notes**:
- GPU is optional but significantly speeds up training (5-10x faster)
- NVIDIA GPUs with CUDA 12.6 or 12.8 support recommended
- AMD GPUs and Apple Silicon currently not supported for training

---

## Installation Guide

### 3.1 Install uv Package Manager

uv is a fast Python package installer and resolver that replaces pip.

**macOS / Linux**:
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

**Windows** (PowerShell):
```powershell
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
```

Verify installation:
```bash
uv --version
```

### 3.2 Python Environment Setup

The project uses `uv` for dependency management with a `pyproject.toml` configuration. The setup process is streamlined into a single command.

**Step 1: Navigate to Project Directory**
```bash
cd GPT-SoVITS
```

**Step 2: Sync All Dependencies**
```bash
# This single command will:
# - Create a virtual environment (.venv)
# - Install Python 3.11 (or your specified version)
# - Install all dependencies from pyproject.toml
# - Install the correct PyTorch version for your platform
uv sync
```

**Step 3: Activate Environment**

macOS / Linux:
```bash
source .venv/bin/activate
```

Windows:
```cmd
.venv\Scripts\activate
```

You should see `(.venv)` prefix in your terminal prompt.

**How Platform-Specific PyTorch Installation Works**:

The `pyproject.toml` automatically selects the appropriate PyTorch version:
- **macOS**: Installs CPU-only PyTorch (Apple Silicon uses CPU mode)
- **Linux**: Installs CUDA 12.6 PyTorch by default
- **Windows**: Manually select CUDA version (see below)

**Windows Users - Choose CUDA Version**:

For Windows, you need to specify the PyTorch index explicitly:

**CUDA 12.6** (default):
```bash
uv sync
```

**CUDA 12.8**:
```bash
uv sync --index pytorch-cu128
```

**CPU Only** (no GPU):
```bash
uv sync --index pytorch-cpu
```

**Verify Installation**:
```bash
# Check Python version
python --version  # Should show Python 3.11.x

# Check PyTorch installation
python -c "import torch; print(f'PyTorch: {torch.__version__}')"

# Check CUDA availability (if you have GPU)
python -c "import torch; print(f'CUDA Available: {torch.cuda.is_available()}')"
```

### 3.3 Download Required Data Files

The following data files are required for text processing and voice training.

#### NLTK Data (Required for Text Processing)

NLTK (Natural Language Toolkit) data is used for text tokenization and processing.

```bash
# Download from ModelScope
wget https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/nltk_data.zip

# Extract to Python environment
unzip -q -o nltk_data.zip -d .venv/

# Clean up
rm nltk_data.zip
```

**Size**: ~10 MB
**Time**: < 1 minute

#### Open JTalk Dictionary (Required for Japanese)

Open JTalk is required for Japanese text-to-speech processing.

```bash
# Get pyopenjtalk installation path
PYOPENJTALK_PATH=$(python -c "import os, pyopenjtalk; print(os.path.dirname(pyopenjtalk.__file__))")

# Download from ModelScope
wget https://www.modelscope.cn/models/XXXXRT/GPT-SoVITS-Pretrained/resolve/master/open_jtalk_dic_utf_8-1.11.tar.gz

# Extract to pyopenjtalk directory
tar -xzf open_jtalk_dic_utf_8-1.11.tar.gz -C "$PYOPENJTALK_PATH"

# Clean up
rm open_jtalk_dic_utf_8-1.11.tar.gz
```

**Size**: ~50 MB
**Time**: < 2 minutes


### 3.4 Frontend Setup

The frontend is an Electron application built with Vue.js.

```bash
# Navigate to frontend directory
cd tts-voice-app

# Install Node.js dependencies
npm install
```

**Time**: 2-5 minutes
**Note**: This installs all required Node.js packages including Electron, Vue, and UI components.

---

## Configuration

### 4.1 Backend API Configuration

The backend uses environment variables for configuration. Create a `.env` file in the project root for custom settings.

**Create `.env` file** (optional, defaults work for local development):

```bash
# Deployment Mode
# Options: local, server
DEPLOYMENT_MODE=local

# API Server Settings
API_HOST=0.0.0.0
API_PORT=8000

# Data Storage Paths
DATA_DIR=~/.moyoyo-tts/data
SQLITE_PATH=~/.moyoyo-tts/data/tasks.db

# Training Settings
LOCAL_MAX_WORKERS=1  # Number of concurrent training tasks
```

**Configuration Options**:

| Variable | Default | Description |
|----------|---------|-------------|
| `DEPLOYMENT_MODE` | `local` | Deployment environment (local/server) |
| `API_HOST` | `0.0.0.0` | API server bind address |
| `API_PORT` | `8000` | API server port |
| `DATA_DIR` | `~/.moyoyo-tts/data` | Directory for data storage |
| `SQLITE_PATH` | `~/.moyoyo-tts/data/tasks.db` | SQLite database path |
| `LOCAL_MAX_WORKERS` | `1` | Max concurrent training tasks |

**Notes**:
- `API_HOST=0.0.0.0` allows connections from any network interface
- `LOCAL_MAX_WORKERS=1` prevents memory issues on systems with limited RAM
- Increase `LOCAL_MAX_WORKERS` on high-end systems to train multiple voices simultaneously

### 4.2 Frontend Configuration

The frontend requires minimal configuration for local development.

**Default Settings**:
- **API Endpoint**: `http://localhost:8000`
- **Voice Storage**: `~/.moyoyo-tts/voices/`
- **Model Storage**: `GPT_SoVITS/pretrained_models/`

**Auto-Configuration**:
The Electron app will:
1. Automatically detect and connect to the local API server
2. Create required directories on first launch
3. Download missing models via the Model Setup page

No manual configuration needed for standard usage.

---

## Running the Application

### 5.1 Start Backend API Server

**Step 1: Activate Python Environment**

```bash
# Navigate to project directory
cd GPT-SoVITS

# Activate virtual environment
source .venv/bin/activate  # macOS/Linux
.venv\Scripts\activate     # Windows
```

**Step 2: Start the API Server**

Method 1 - Using the main script:
```bash
cd api_server
python app/main.py
```

Method 2 - Using uvicorn directly:
```bash
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
```

**Expected Output**:
```
INFO:     Started server process [12345]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
```

**API Documentation**:
Once the server is running, access interactive API documentation:

- **Swagger UI**: http://localhost:8000/docs
- **ReDoc**: http://localhost:8000/redoc
- **OpenAPI JSON**: http://localhost:8000/openapi.json

**Health Check**:
```bash
curl http://localhost:8000/health
# Expected: {"status": "healthy"}
```

### 5.2 Start Frontend Electron App

**Step 1: Open New Terminal**

Keep the backend server running and open a new terminal window.

**Step 2: Navigate to Frontend Directory**

```bash
cd tts-voice-app
```

**Step 3: Start Development Mode**

```bash
npm run dev
```

**Expected Output**:
```
> tts-voice-app@1.0.0 dev
> electron-vite dev

  VITE v4.x.x  ready in xxx ms
  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose

Electron app starting...
```

The Electron application will launch automatically with hot-reload enabled for development.

**Features in Development Mode**:
- Hot module replacement (HMR) for instant UI updates
- Vue DevTools integration
- Console logging for debugging
- Automatic restart on main process changes

---

## First-Time Setup

When you first launch the Electron app, you'll need to download required models.

**Setup Process**:

1. **Launch the Electron App**
   ```bash
   cd tts-voice-app
   npm run dev
   ```

2. **Model Setup Page**
   - The app automatically detects missing models
   - You'll be redirected to the Model Setup page

3. **Download Models**
   - Click "Download All Models" button
   - Models to be downloaded:
     - **Pretrained Models**: 4.56 GB
     - **G2PW Model**: 588.86 MB
     - **FunASR**: 1.09 GB
     - **Faster Whisper**: 2.85 GB
   - Total download size: ~9 GB

4. **Monitor Progress**
   - Real-time progress bars show download status
   - Estimated time: 10-30 minutes (depends on connection)
   - Downloads can be paused and resumed

5. **Setup Complete**
   - Once all models are downloaded, click "Continue"
   - You'll be redirected to the main TTS page
   - The app is now ready to use

**Troubleshooting**:
- If downloads fail, check your internet connection
- Verify you have ~10 GB free disk space
- For manual installation, see section 3.3

---

## Feature Overview

MoYoYo.tts provides powerful voice cloning and text-to-speech capabilities through an intuitive interface:

**Quick Mode** offers a streamlined one-click workflow perfect for beginners. Simply upload a 5-30 second audio sample, select your quality preset (fast/standard/high), and start training. The system automatically handles all pipeline stages including audio processing, speech recognition, feature extraction, and model training. Within 10-40 minutes, you'll have a custom voice ready for text-to-speech generation.

**Advanced Mode** gives experienced users granular control over each stage of the training pipeline. You can fine-tune parameters for audio slicing, choose between ASR models (DamoASR for Chinese, Faster Whisper for multilingual), adjust training epochs and batch sizes, and monitor detailed progress for each stage. This mode is ideal for optimizing quality or working with specific audio characteristics.

**Text-to-Speech Generation** allows you to instantly use any trained voice to convert text into natural-sounding speech. Adjust speaking speed (0.5x-2.0x), select emotional tones if supported, and generate high-quality audio output in seconds. The system supports multiple languages and provides real-time audio playback and download capabilities.

**Voice Library Management** keeps all your trained voices organized in one place. Browse, search, and filter voices by language or quality. Preview any voice with sample audio, export models for backup or sharing, and manage your voice collection efficiently.

For detailed API documentation and advanced usage, visit the interactive Swagger UI at **http://localhost:8000/docs** when the backend server is running.

---

## Troubleshooting

### Backend Issues

#### Port Already in Use

**Symptom**: Error message `Address already in use` when starting server.

**Solution 1** - Change port in `.env`:
```bash
echo "API_PORT=8001" >> .env
python app/main.py
```

**Solution 2** - Find and kill process using port:
```bash
# macOS/Linux
lsof -ti:8000 | xargs kill -9

# Windows
netstat -ano | findstr :8000
taskkill /PID <pid> /F
```

#### Database Errors

**Symptom**: `sqlite3.OperationalError` or database corruption messages.

**Solution** - Reset database:
```bash
# Backup existing database (optional)
cp ~/.moyoyo-tts/data/tasks.db ~/.moyoyo-tts/data/tasks.db.backup

# Remove corrupted database
rm ~/.moyoyo-tts/data/tasks.db

# Restart API server (database will be recreated)
python app/main.py
```

#### Python Environment Issues

**Symptom**: `ModuleNotFoundError` or import errors.

**Solution**:
```bash
# Verify environment is activated
which python  # Should show path in .venv

# Reinstall all dependencies
uv sync --reinstall

# Or force reinstall from scratch
rm -rf .venv
uv sync

# Check for missing packages
uv pip list
```

### Frontend Issues

#### Cannot Connect to API

**Symptom**: Frontend shows "Cannot connect to server" error.

**Diagnosis**:
```bash
# Check if backend is running
curl http://localhost:8000/health

# Check network connectivity
ping localhost
```

**Solutions**:
1. **Backend not running**: Start backend server (see section 5.1)
2. **Wrong port**: Check backend is on port 8000
3. **Firewall**: Allow connections to localhost:8000
4. **CORS error**: Check CORS settings in backend `.env`

#### Models Not Downloading

**Symptom**: Model download fails or hangs indefinitely.

**Solutions**:
1. **Check internet connection**:
   ```bash
   curl -I https://www.modelscope.cn
   ```

2. **Check disk space**:
   ```bash
   df -h  # Need ~10GB free
   ```

3. **Manual download**: See section 3.3 for manual installation

4. **Proxy issues**: Configure proxy settings:
   ```bash
   export http_proxy=http://proxy.example.com:8080
   export https_proxy=http://proxy.example.com:8080
   ```

#### Electron App Won't Start

**Symptom**: App crashes on launch or shows blank screen.

**Solution 1** - Clear cache and rebuild:
```bash
# Navigate to frontend directory
cd tts-voice-app

# Clear cache
rm -rf node_modules package-lock.json dist .vite

# Reinstall dependencies
npm install

# Rebuild
npm run dev
```

**Solution 2** - Check Node.js version:
```bash
node --version  # Should be >= 18.x

# Update Node.js if needed
nvm install 18
nvm use 18
```

**Solution 3** - Check Electron logs:
```bash
# macOS
~/Library/Logs/tts-voice-app/

# Linux
~/.config/tts-voice-app/logs/

# Windows
%APPDATA%\tts-voice-app\logs\
```

---

**Last Updated**: 2026-01-23
**Version**: 1.0.0
**Maintainers**: MoYoYo.tts Development Team