File size: 5,278 Bytes
773590a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# πŸŽ™οΈ VoxCPM2 - Full Capability Tools

**Complete toolkit for [openbmb/VoxCPM2](https://huggingface.co/openbmb/VoxCPM2)** β€” a 2B parameter tokenizer-free diffusion TTS model with voice cloning, voice design, and multilingual synthesis.

[![Model](https://img.shields.io/badge/πŸ€—_Model-openbmb/VoxCPM2-blue)](https://huggingface.co/openbmb/VoxCPM2)
[![Paper](https://img.shields.io/badge/πŸ“„_Paper-arXiv:2509.24650-red)](https://arxiv.org/abs/2509.24650)
[![Docs](https://img.shields.io/badge/πŸ“–_Docs-voxcpm.readthedocs.io-green)](https://voxcpm.readthedocs.io/)

---

## πŸ“¦ What's Included

| File | Purpose |
|------|---------|
| `voxcpm2_local_laptop.py` | **Local inference script** β€” optimized for Ryzen 7 + 16GB RAM CPU |
| `VoxCPM2_Colab_Notebook.ipynb` | **Google Colab notebook** β€” free T4 GPU, all capabilities + Gradio UI |
| `README.md` | This file β€” full documentation |

---

## πŸš€ Quick Start (Google Colab β€” FREE)

1. **Open the notebook** in Colab:
   - Download: [`VoxCPM2_Colab_Notebook.ipynb`](https://huggingface.co/SWAG456/voxcpm2-tools/blob/main/VoxCPM2_Colab_Notebook.ipynb)
   - Or open directly: [Open in Colab](https://colab.research.google.com/)

2. **Run all cells top to bottom** β€” installs `voxcpm`, downloads ~4.6GB model, then:
   - πŸ”Š Basic TTS
   - 🎨 Voice Design
   - 🌐 Multilingual (30+ languages)
   - πŸ‘€ Zero-Shot Voice Cloning (upload your voice!)
   - 🎡 Hi-Fi Ultimate Cloning
   - πŸ“‘ Streaming Generation
   - πŸ–₯️ **Interactive Gradio UI** with public URL

3. **GPU memory optimized** for free T4 tier (~8GB VRAM used out of 16GB)

---

## πŸ’» Local Laptop (Ryzen 7 + 16GB RAM)

### Install
```bash
pip install voxcpm soundfile torch
```

### Run All Demos
```bash
python voxcpm2_local_laptop.py --demo
```

### Run Specific Modes
```bash
# Basic TTS
python voxcpm2_local_laptop.py --text "Hello world"

# Voice Design (natural language voice control)
python voxcpm2_local_laptop.py --mode design \
  --description "warm female voice" \
  --text "Hello there"

# Voice Cloning (needs reference WAV file)
python voxcpm2_local_laptop.py --mode clone \
  --text "This is my cloned voice" \
  --reference my_voice.wav

# Multilingual demo
python voxcpm2_local_laptop.py --mode multilingual

# Speed mode (lower timesteps = faster)
python voxcpm2_local_laptop.py --text "Hello" --timesteps 5
```

---

## πŸŽ›οΈ All Capabilities Explained

### 1. πŸ”Š Basic TTS
Just text β†’ audio. Fastest mode. 48kHz studio-quality output.

### 2. 🎨 Voice Design
Control voice characteristics with natural language descriptions:
```python
"(A young woman, gentle and soothing voice) Hello!"
"(A deep male narrator, professional tone) Welcome."
"(A robot, monotone synthetic voice) System online."
```

### 3. πŸ‘€ Zero-Shot Voice Cloning
Clone ANY voice from a 3-10 second audio sample. Upload a WAV and the model mimics the speaker perfectly.

### 4. 🎡 Hi-Fi Ultimate Cloning
Best quality cloning combining:
- **Prompt audio** + transcript (for prosody/style)
- **Reference audio** (for timbre)

### 5. 🌐 Multilingual (30+ Languages)
No language tags needed. Just write in the target language:
- English, Chinese, Spanish, French, German, Japanese, Korean
- Arabic, Hindi, Portuguese, Russian, Italian, Dutch, Polish
- Turkish, Vietnamese, Thai, Indonesian, and more

### 6. πŸ“‘ Streaming Generation
Generate long texts chunk-by-chunk. Memory-efficient for audiobooks.

---

## βš™οΈ Speed vs Quality

| Timesteps | Quality | Speed | Best For |
|-----------|---------|-------|----------|
| 4-5       | Draft   | ⚑ Fast | Testing |
| 8-10      | Good    | πŸš€ Normal | Default, balanced |
| 15-20     | High    | 🐒 Slow | Voice cloning |
| 25-30     | Best    | 🐌 Very Slow | Audiobooks |

**Parameter: `inference_timesteps`** β€” lower = faster, higher = better quality.

---

## πŸ–₯️ Hardware Requirements

| Setup | VRAM/RAM | Feasibility | Notes |
|-------|----------|-------------|-------|
| **Colab T4 (Free)** | 16GB GPU | βœ… Perfect | `load_denoiser=False` saves ~500MB |
| **Ryzen 7 + 16GB RAM** | 16GB CPU | βœ… Works | CPU mode, slower but functional |
| **RTX 3060/4060** | 12GB GPU | βœ… Good | Same settings as Colab |
| **Apple Silicon M1-M3** | Unified | βœ… Works | `device="mps"` |

---

## πŸ”§ Memory Optimizations Applied

Both scripts use these settings to fit in 16GB:
- `load_denoiser=False` β€” Skip ZipEnhancer (~500MB saved)
- `optimize=False` on CPU β€” Skip torch.compile overhead
- `optimize=True` on GPU β€” Enable torch.compile for speed
- `device="auto"` / `"cpu"` / `"cuda"` β€” Proper device selection

---

## πŸ“š Model Info

- **Parameters:** 2B
- **Architecture:** MiniCPM-4 β†’ LocEnc β†’ TSLM β†’ RALM β†’ LocDiT β†’ AudioVAE V2
- **Output:** 48kHz WAV
- **License:** Apache-2.0 (commercial use OK)
- **Paper:** [arXiv:2509.24650](https://arxiv.org/abs/2509.24650)

---

## πŸ“ License

These scripts are provided as-is for personal/educational use. The VoxCPM2 model is Apache-2.0 licensed.

---

## πŸ”— Links

- [Model on HuggingFace](https://huggingface.co/openbmb/VoxCPM2)
- [Official Documentation](https://voxcpm.readthedocs.io/)
- [Paper on arXiv](https://arxiv.org/abs/2509.24650)
- [OpenBMB GitHub](https://github.com/OpenBMB/VoxCPM)