Spaces:
Running
Running
Solution: Multi-Voice TTS with Transformers.js (Browser-Only)
#9
by
masbudjj - opened
README.md
CHANGED
|
@@ -1,136 +1,197 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: ποΈ
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version: 4.44.0
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# ποΈ
|
| 14 |
|
| 15 |
-
**
|
| 16 |
|
| 17 |
## β¨ Features
|
| 18 |
|
| 19 |
-
### π
|
| 20 |
-
|
| 21 |
-
#### πΊπΈ American
|
| 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 |
-
- Fable - Storyteller
|
| 55 |
-
- Lewis - Smooth
|
| 56 |
-
- Daniel - Professional
|
| 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 |
-
## π Comparison
|
| 102 |
|
| 103 |
-
| Feature |
|
| 104 |
-
|---------|----------
|
| 105 |
-
| **Voices** |
|
| 106 |
-
| **
|
| 107 |
-
| **
|
| 108 |
-
| **
|
| 109 |
-
| **
|
| 110 |
|
| 111 |
---
|
| 112 |
|
| 113 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
- **Training**: Ethical permissive-licensed data only
|
| 119 |
|
| 120 |
---
|
| 121 |
|
| 122 |
## π License
|
| 123 |
|
| 124 |
-
Apache 2.0 - Free for commercial use
|
| 125 |
|
| 126 |
---
|
| 127 |
|
| 128 |
-
##
|
| 129 |
|
| 130 |
-
-
|
| 131 |
-
-
|
| 132 |
-
-
|
|
|
|
| 133 |
|
| 134 |
---
|
| 135 |
|
| 136 |
-
**Built with β€οΈ using
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Multi-Voice TTS - 24 Unique Voices
|
| 3 |
emoji: ποΈ
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: purple
|
| 6 |
+
sdk: static
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# ποΈ Multi-Voice Text-to-Speech
|
| 12 |
|
| 13 |
+
**24 Unique Voices - 100% Browser-Based - No Server Required**
|
| 14 |
|
| 15 |
## β¨ Features
|
| 16 |
|
| 17 |
+
### π 24 Unique Voice Characters
|
| 18 |
+
|
| 19 |
+
#### πΊπΈ American Female (6 voices)
|
| 20 |
+
- **Default** - Neutral baseline
|
| 21 |
+
- **Warm** - Friendly & caring
|
| 22 |
+
- **Bright** - Energetic & happy
|
| 23 |
+
- **Soft** - Gentle & calm
|
| 24 |
+
- **Clear** - Professional
|
| 25 |
+
- **Smooth** - Elegant
|
| 26 |
+
|
| 27 |
+
#### πΊπΈ American Male (6 voices)
|
| 28 |
+
- **Default** - Neutral baseline
|
| 29 |
+
- **Deep** - Authoritative
|
| 30 |
+
- **Friendly** - Approachable
|
| 31 |
+
- **Strong** - Confident
|
| 32 |
+
- **Calm** - Relaxed
|
| 33 |
+
- **Professional** - Business-oriented
|
| 34 |
+
|
| 35 |
+
#### π¬π§ British Female (4 voices)
|
| 36 |
+
- **Refined** - Elegant
|
| 37 |
+
- **Bright** - Cheerful
|
| 38 |
+
- **Soft** - Gentle
|
| 39 |
+
- **Clear** - Articulate
|
| 40 |
+
|
| 41 |
+
#### π¬π§ British Male (4 voices)
|
| 42 |
+
- **Distinguished** - Formal
|
| 43 |
+
- **Smooth** - Sophisticated
|
| 44 |
+
- **Warm** - Friendly
|
| 45 |
+
- **Strong** - Commanding
|
| 46 |
+
|
| 47 |
+
#### π International (4 voices)
|
| 48 |
+
- **Neutral** - Standard
|
| 49 |
+
- **Soft** - Gentle
|
| 50 |
+
- **Clear** - Professional
|
| 51 |
+
- **Warm** - Friendly
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
---
|
| 54 |
|
| 55 |
+
## π¨ Voice Customization
|
| 56 |
|
| 57 |
+
Each voice can be further customized with:
|
| 58 |
+
|
| 59 |
+
- **Pitch Control** (0.5x - 1.5x) - Adjust voice pitch
|
| 60 |
+
- **Energy Control** (0.5x - 1.5x) - Modify speaking energy
|
| 61 |
+
- **Speed Control** (0.5x - 2.0x) - Playback speed
|
| 62 |
+
|
| 63 |
+
**Total Combinations:** 24 voices Γ unlimited pitch/energy variations = **Infinite possibilities!**
|
| 64 |
|
| 65 |
---
|
| 66 |
|
| 67 |
+
## ποΈ Technology
|
| 68 |
+
|
| 69 |
+
### Base Model
|
| 70 |
+
- **SpeechT5** from Microsoft
|
| 71 |
+
- **ONNX Runtime** for browser execution
|
| 72 |
+
- **WebAssembly** backend
|
| 73 |
|
| 74 |
+
### Voice Generation
|
| 75 |
+
Each of the 24 voices is created by:
|
| 76 |
+
1. Taking base speaker embedding (512-dim)
|
| 77 |
+
2. Applying pitch transformation
|
| 78 |
+
3. Modulating energy levels
|
| 79 |
+
4. Spectral shaping for character
|
| 80 |
+
5. Prosody adjustment
|
| 81 |
+
6. Normalization
|
| 82 |
|
| 83 |
---
|
| 84 |
|
| 85 |
+
## π Features
|
| 86 |
+
|
| 87 |
+
β
**24 Unique Voices** - Diverse characters
|
| 88 |
+
β
**100% Browser-Based** - No server needed
|
| 89 |
+
β
**Voice Customization** - Pitch & energy controls
|
| 90 |
+
β
**Fast Generation** - 2-5 seconds
|
| 91 |
+
β
**High Quality** - SpeechT5 architecture
|
| 92 |
+
β
**Offline Capable** - Works after first load
|
| 93 |
+
β
**Privacy Focused** - No data sent to servers
|
| 94 |
+
β
**Free & Open Source** - Apache 2.0 license
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
|
| 98 |
+
## π» How It Works
|
| 99 |
+
|
| 100 |
+
### Voice Profile System
|
| 101 |
+
```javascript
|
| 102 |
+
const VOICE_PROFILES = {
|
| 103 |
+
af_warm: {
|
| 104 |
+
pitch: 0.95, // Slightly lower
|
| 105 |
+
energy: 1.1, // More energetic
|
| 106 |
+
spectral: 0.2 // Brighter tone
|
| 107 |
+
},
|
| 108 |
+
am_deep: {
|
| 109 |
+
pitch: 0.7, // Much lower
|
| 110 |
+
energy: 1.1, // Strong
|
| 111 |
+
spectral: -0.5 // Darker tone
|
| 112 |
+
},
|
| 113 |
+
// ... 24 total profiles
|
| 114 |
+
};
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
### Generation Process
|
| 118 |
+
```
|
| 119 |
+
User Input Text
|
| 120 |
+
β
|
| 121 |
+
Select Voice Profile
|
| 122 |
+
β
|
| 123 |
+
Load Base Speaker Embedding
|
| 124 |
+
β
|
| 125 |
+
Apply Transformations:
|
| 126 |
+
- Pitch modification
|
| 127 |
+
- Energy modulation
|
| 128 |
+
- Spectral shaping
|
| 129 |
+
- User adjustments (pitch/energy sliders)
|
| 130 |
+
β
|
| 131 |
+
Normalize Embedding
|
| 132 |
+
β
|
| 133 |
+
SpeechT5 Generation
|
| 134 |
+
β
|
| 135 |
+
WAV Output
|
| 136 |
+
```
|
| 137 |
|
| 138 |
---
|
| 139 |
|
| 140 |
+
## π― Use Cases
|
| 141 |
+
|
| 142 |
+
**Professional/Corporate:**
|
| 143 |
+
- af_clear, am_professional, bf_clear, bm_distinguished
|
| 144 |
+
|
| 145 |
+
**Friendly/Casual:**
|
| 146 |
+
- af_warm, am_friendly, bf_bright, int_warm
|
| 147 |
|
| 148 |
+
**Storytelling/Narration:**
|
| 149 |
+
- af_smooth, am_calm, bf_refined, bm_smooth
|
| 150 |
+
|
| 151 |
+
**Energetic/Marketing:**
|
| 152 |
+
- af_bright, am_strong, bf_bright
|
| 153 |
|
| 154 |
---
|
| 155 |
|
| 156 |
+
## π Comparison
|
| 157 |
|
| 158 |
+
| Feature | This App | SpeechT5 Basic | Kokoro-82M |
|
| 159 |
+
|---------|----------|----------------|------------|
|
| 160 |
+
| **Voices** | 24 | 1 | 54 |
|
| 161 |
+
| **Browser** | β
Yes | β
Yes | β No |
|
| 162 |
+
| **Customization** | β
Pitch/Energy | β Limited | β
Yes |
|
| 163 |
+
| **Server** | β Not needed | β Not needed | β
Required |
|
| 164 |
+
| **Speed** | β‘ Fast | β‘ Fast | β±οΈ Medium |
|
| 165 |
|
| 166 |
---
|
| 167 |
|
| 168 |
+
## π§ Technical Details
|
| 169 |
+
|
| 170 |
+
**Model:** Xenova/speecht5_tts
|
| 171 |
+
**Size:** ~50MB (cached after first load)
|
| 172 |
+
**Format:** ONNX (quantized)
|
| 173 |
+
**Sample Rate:** 16kHz
|
| 174 |
+
**Output:** WAV (16-bit PCM)
|
| 175 |
|
| 176 |
+
**Voice Embedding:** 512-dimensional vector
|
| 177 |
+
**Transformations:** Pitch, energy, spectral
|
| 178 |
+
**Normalization:** Z-score (mean=0, std=1)
|
|
|
|
| 179 |
|
| 180 |
---
|
| 181 |
|
| 182 |
## π License
|
| 183 |
|
| 184 |
+
Apache 2.0 - Free for personal and commercial use
|
| 185 |
|
| 186 |
---
|
| 187 |
|
| 188 |
+
## π Credits
|
| 189 |
|
| 190 |
+
- **Base Model:** Microsoft SpeechT5
|
| 191 |
+
- **ONNX Conversion:** Xenova/transformers.js
|
| 192 |
+
- **Voice Profiles:** Custom implementation
|
| 193 |
+
- **UI:** Modern glassmorphism design
|
| 194 |
|
| 195 |
---
|
| 196 |
|
| 197 |
+
**Built with β€οΈ using Transformers.js**
|