File size: 4,087 Bytes
ecd462c
795315f
 
 
 
 
 
 
 
ecd462c
 
 
 
 
 
795315f
ecd462c
795315f
ecd462c
 
 
 
 
795315f
ecd462c
795315f
ecd462c
795315f
 
 
 
 
ecd462c
816dc78
22bd33d
795315f
22bd33d
795315f
 
 
 
 
 
 
 
 
 
ecd462c
795315f
 
ecd462c
795315f
ecd462c
795315f
 
 
 
 
 
ecd462c
795315f
 
 
 
 
 
ecd462c
795315f
ecd462c
795315f
ecd462c
795315f
 
ecd462c
795315f
 
 
ecd462c
795315f
ecd462c
795315f
 
 
ecd462c
 
795315f
ecd462c
 
 
 
 
795315f
 
ecd462c
22bd33d
ecd462c
795315f
ecd462c
 
 
 
 
 
795315f
 
 
 
 
 
 
 
ecd462c
 
 
795315f
 
 
 
 
ecd462c
795315f
ecd462c
795315f
 
ecd462c
795315f
ecd462c
 
 
795315f
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
---
language:
  - en
  - es
  - fr
  - hi
  - it
  - pt
  - zh
license: apache-2.0
library_name: transformers
pipeline_tag: text-to-speech
tags:
  - text-to-speech
  - tts
  - multilingual
  - speecht5
  - kokoro
  - sol
---

# Sol

**Sol** is an open text-to-speech engine: type text, get clear speech.

It comes in two parts:

1. **The live engine** — a multilingual, multi-voice TTS service running on
   [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) with **49 voices across
   8 languages**. Self-hosted, CPU-only, and reachable 24/7.
2. **Sol v1** — a `SpeechT5` acoustic model we fine-tuned on public
   LibriSpeech voice data, whose weights live in **this repository**.



## Voices & languages

| Language | Code | Voices |
|---|---|---|
| English (US) | `en-us` | 20 |
| English (UK) | `en-gb` | 8 |
| Chinese (Mandarin) | `zh` | 8 |
| Hindi | `hi` | 4 |
| Spanish | `es` | 3 |
| Portuguese (Brazil) | `pt-br` | 3 |
| Italian | `it` | 2 |
| French | `fr-fr` | 1 |

**49 voices total.** Voice ids look like `af_heart` (American female), `am_michael`
(American male), `bf_emma` (British female), `ef_dora` (Spanish female), and so on.

## Use the live API

```bash
curl -X POST "$SOL_API/api/tts" \
  -H "Content-Type: application/json" \
  -d '{"text":"hello from sol","voice":"af_heart","speed":1.0}' \
  --output sol.wav
```

| Endpoint | Method | Purpose |
|---|---|---|
| `/api/health` | GET | service status |
| `/api/languages` | GET | supported languages + voice counts |
| `/api/voices` | GET | every voice (optional `?lang=en-us`) |
| `/api/tts` | POST | `{text, voice, speed}` → `audio/wav` (24 kHz) |

Audio is silence-trimmed and peak-normalised, so output is clean with no static.

### Multilingual samples

A sample in each language lives in
[`examples/multilingual/`](./examples/multilingual):

<audio controls src="examples/multilingual/en-us.wav"></audio>
<audio controls src="examples/multilingual/es.wav"></audio>
<audio controls src="examples/multilingual/zh.wav"></audio>

## Sol v1 — the fine-tuned SpeechT5 model

This repository also ships **Sol v1**, a `SpeechT5` model fine-tuned on a
single-speaker subset of [LibriSpeech](https://www.openslr.org/12) (87 utterances,
light fine-tune, lr 2e-6) and paired with the `speecht5_hifigan` vocoder.

```python
import numpy as np, soundfile as sf, torch
from transformers import SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Processor

repo = "itriedcoding/Sol"

processor = SpeechT5Processor.from_pretrained(repo)
model     = SpeechT5ForTextToSpeech.from_pretrained(repo)
vocoder   = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan")

speaker = torch.tensor(np.load("speaker_embedding.npy")).unsqueeze(0)

inputs = processor(text="hello, i am sol.", return_tensors="pt")
with torch.no_grad():
    speech = model.generate_speech(inputs["input_ids"], speaker, vocoder=vocoder)

sf.write("sol.wav", speech.numpy(), samplerate=16000)
```

> Keep the speaker embedding at its original scale — it is a raw x-vector with
> norm ≈ 320. Do **not** unit-normalise it, or the voice degrades.

## Self-hosting

The engine is served from a FastAPI app (`server/app.py`) that loads Kokoro-82M
locally and exposes the endpoints above on `127.0.0.1:8000`, then published with a
Cloudflare tunnel. It starts automatically at logon and runs without a GPU.

## Intended use & limitations

- **Intended use:** research, prototyping, accessibility and demos.
- **Limitations:** 8 languages; may mispronounce rare names, numbers and unusual
  punctuation; Japanese is not currently enabled (G2P dependency).
- Output is not a human voice and must not be used for impersonation or deceptive
  audio.

## Credits

- Engine: [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) by hexgrad.
- SpeechT5 v1 voice data: [LibriSpeech](https://www.openslr.org/12), CC BY 4.0.
- Base model & vocoder: Microsoft Research Asia, via 🤗 Transformers.
- Fine-tuned, hosted and packaged by the **Sol** project.

## License

Apache-2.0. Please respect the original dataset, base-model and engine licenses.