voicesynth-voicegenerator 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- voicesynth_voicegenerator-0.1.0/.gitlab-ci.yml +57 -0
- voicesynth_voicegenerator-0.1.0/IMPLEMENTATION_STATUS.md +25 -0
- voicesynth_voicegenerator-0.1.0/LICENSE +21 -0
- voicesynth_voicegenerator-0.1.0/MANIFEST.in +9 -0
- voicesynth_voicegenerator-0.1.0/PKG-INFO +243 -0
- voicesynth_voicegenerator-0.1.0/README.md +205 -0
- voicesynth_voicegenerator-0.1.0/docs/architecture.md +12 -0
- voicesynth_voicegenerator-0.1.0/docs/audio-engine.md +14 -0
- voicesynth_voicegenerator-0.1.0/docs/cli.md +11 -0
- voicesynth_voicegenerator-0.1.0/docs/colab-training.md +69 -0
- voicesynth_voicegenerator-0.1.0/docs/index.md +25 -0
- voicesynth_voicegenerator-0.1.0/docs/library.md +15 -0
- voicesynth_voicegenerator-0.1.0/docs/prosody.md +13 -0
- voicesynth_voicegenerator-0.1.0/docs/publishing.md +94 -0
- voicesynth_voicegenerator-0.1.0/docs/realtime.md +24 -0
- voicesynth_voicegenerator-0.1.0/docs/requirements.txt +2 -0
- voicesynth_voicegenerator-0.1.0/docs/training.md +82 -0
- voicesynth_voicegenerator-0.1.0/docs/troubleshooting.md +34 -0
- voicesynth_voicegenerator-0.1.0/docs/voicebanks.md +20 -0
- voicesynth_voicegenerator-0.1.0/examples/VoiceSynth_Colab_Training.ipynb +239 -0
- voicesynth_voicegenerator-0.1.0/examples/basic_usage.py +11 -0
- voicesynth_voicegenerator-0.1.0/examples/train_and_generate.py +10 -0
- voicesynth_voicegenerator-0.1.0/mkdocs.yml +31 -0
- voicesynth_voicegenerator-0.1.0/pyproject.toml +41 -0
- voicesynth_voicegenerator-0.1.0/setup.cfg +4 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/__init__.py +6 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/audio/__init__.py +1 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/audio/loader.py +68 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/audio/streaming.py +50 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/cli/main.py +143 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/engine/__init__.py +1 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/engine/synthesizer.py +162 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/exceptions.py +14 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/model/__init__.py +1 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/model/archive.py +107 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/project.py +69 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/prosody/__init__.py +3 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/prosody/inference.py +39 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/prosody/model.py +7 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/prosody/trainer.py +66 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/text/__init__.py +3 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/text/phonemizer.py +107 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/training/pipeline.py +155 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth/voice.py +114 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth_voicegenerator.egg-info/PKG-INFO +243 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth_voicegenerator.egg-info/SOURCES.txt +49 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth_voicegenerator.egg-info/dependency_links.txt +1 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth_voicegenerator.egg-info/entry_points.txt +2 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth_voicegenerator.egg-info/requires.txt +32 -0
- voicesynth_voicegenerator-0.1.0/src/voicesynth_voicegenerator.egg-info/top_level.txt +1 -0
- voicesynth_voicegenerator-0.1.0/tests/test_basic.py +133 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- test
|
|
3
|
+
- build
|
|
4
|
+
- deploy
|
|
5
|
+
|
|
6
|
+
default:
|
|
7
|
+
image: python:3.13
|
|
8
|
+
before_script:
|
|
9
|
+
- python -m pip install --upgrade pip
|
|
10
|
+
|
|
11
|
+
test:
|
|
12
|
+
stage: test
|
|
13
|
+
script:
|
|
14
|
+
- python -m pip install ".[test]"
|
|
15
|
+
- python -m pytest
|
|
16
|
+
|
|
17
|
+
build-package:
|
|
18
|
+
stage: build
|
|
19
|
+
script:
|
|
20
|
+
- python -m pip install build twine
|
|
21
|
+
- python -m build
|
|
22
|
+
- python -m twine check dist/*
|
|
23
|
+
artifacts:
|
|
24
|
+
paths:
|
|
25
|
+
- dist/
|
|
26
|
+
expire_in: 1 week
|
|
27
|
+
|
|
28
|
+
docs-check:
|
|
29
|
+
stage: build
|
|
30
|
+
script:
|
|
31
|
+
- python -m pip install -r docs/requirements.txt
|
|
32
|
+
- mkdocs build --strict --site-dir site-check
|
|
33
|
+
|
|
34
|
+
pages:
|
|
35
|
+
stage: deploy
|
|
36
|
+
script:
|
|
37
|
+
- python -m pip install -r docs/requirements.txt
|
|
38
|
+
- mkdocs build --strict --site-dir public
|
|
39
|
+
artifacts:
|
|
40
|
+
paths:
|
|
41
|
+
- public/
|
|
42
|
+
expire_in: 1 week
|
|
43
|
+
rules:
|
|
44
|
+
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
45
|
+
|
|
46
|
+
publish-pypi:
|
|
47
|
+
stage: deploy
|
|
48
|
+
image: python:3-bookworm
|
|
49
|
+
dependencies:
|
|
50
|
+
- build-package
|
|
51
|
+
id_tokens:
|
|
52
|
+
PYPI_ID_TOKEN:
|
|
53
|
+
aud: pypi
|
|
54
|
+
script:
|
|
55
|
+
- python -m pip install -U twine
|
|
56
|
+
|
|
57
|
+
- twine upload dist/*
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Implementation Status
|
|
2
|
+
|
|
3
|
+
The repository contains a working implementation:
|
|
4
|
+
|
|
5
|
+
- installable `src` package and CLI entry point
|
|
6
|
+
- versioned ZIP `.vvoice` archives with required-file and path validation
|
|
7
|
+
- 24 kHz mono WAV loading/resampling/silence trimming
|
|
8
|
+
- offline English normalization and ARPABET-style phonemization
|
|
9
|
+
- individual recording addition and CSV dataset import
|
|
10
|
+
- Viterbi-envelope recording/phone duration estimation
|
|
11
|
+
- phoneme unit indexing and concatenative synthesis
|
|
12
|
+
- speed, pitch, volume, pause, stability, and seed controls
|
|
13
|
+
- diagnostics for missing units and timing estimates
|
|
14
|
+
- WAV/MP3 exports
|
|
15
|
+
- PCM streaming and optional sounddevice playback
|
|
16
|
+
- Project segment timeline and volume curves
|
|
17
|
+
|
|
18
|
+
## Remaining implementation work
|
|
19
|
+
|
|
20
|
+
- integrate an exact external forced-alignment backend
|
|
21
|
+
- add production overlap-add joins based on measured waveform boundaries
|
|
22
|
+
- expand the pitch-preserving DSP implementation
|
|
23
|
+
- expand the English pronunciation dictionary
|
|
24
|
+
- add resume state and persistent dataset import reports
|
|
25
|
+
- add benchmark and realtime underrun instrumentation
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voicesynth-voicegenerator
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local hybrid concatenative voice synthesis
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Documentation, https://goonlabs-group.gitlab.io/voicesynth/
|
|
7
|
+
Project-URL: Source, https://gitlab.com/goonlabs-group/voicesynth
|
|
8
|
+
Project-URL: Issues, https://gitlab.com/goonlabs-group/voicesynth/issues
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: numpy>=1.26
|
|
13
|
+
Requires-Dist: scipy>=1.12
|
|
14
|
+
Requires-Dist: soundfile>=0.12
|
|
15
|
+
Requires-Dist: typer>=0.12
|
|
16
|
+
Provides-Extra: training
|
|
17
|
+
Requires-Dist: torch>=2.2; extra == "training"
|
|
18
|
+
Requires-Dist: onnx>=1.16; extra == "training"
|
|
19
|
+
Provides-Extra: onnx
|
|
20
|
+
Requires-Dist: onnxruntime>=1.18; extra == "onnx"
|
|
21
|
+
Provides-Extra: realtime
|
|
22
|
+
Requires-Dist: sounddevice>=0.5; extra == "realtime"
|
|
23
|
+
Provides-Extra: mp3
|
|
24
|
+
Requires-Dist: imageio-ffmpeg>=0.6; extra == "mp3"
|
|
25
|
+
Provides-Extra: all
|
|
26
|
+
Requires-Dist: torch>=2.2; extra == "all"
|
|
27
|
+
Requires-Dist: onnx>=1.16; extra == "all"
|
|
28
|
+
Requires-Dist: onnxruntime>=1.18; extra == "all"
|
|
29
|
+
Requires-Dist: sounddevice>=0.5; extra == "all"
|
|
30
|
+
Requires-Dist: imageio-ffmpeg>=0.6; extra == "all"
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
33
|
+
Requires-Dist: pytest-cov>=5; extra == "test"
|
|
34
|
+
Provides-Extra: publishing
|
|
35
|
+
Requires-Dist: build>=1.2; extra == "publishing"
|
|
36
|
+
Requires-Dist: twine>=5; extra == "publishing"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# VoiceSynth
|
|
40
|
+
|
|
41
|
+
VoiceSynth is a local, installable hybrid unit-selection text-to-speech engine for English. It creates portable `.vvoice` archives from recordings and transcripts, generates mono 24 kHz PCM, exports WAV/MP3, and streams PCM chunks.
|
|
42
|
+
|
|
43
|
+
## End-to-end status
|
|
44
|
+
|
|
45
|
+
VoiceSynth provides real audio processing, unit extraction, archive export/import,
|
|
46
|
+
unit-selection synthesis, PCM streaming, WAV export, MP3 export, optional ONNX
|
|
47
|
+
prosody, and optional sounddevice playback. Alignment is explicitly reported:
|
|
48
|
+
voice lines use a Viterbi-envelope duration estimate and are not presented as
|
|
49
|
+
phoneme-accurate forced alignment.
|
|
50
|
+
|
|
51
|
+
## Requirements
|
|
52
|
+
|
|
53
|
+
- Windows 10/11 or another Python-capable platform
|
|
54
|
+
- Python 3.10+ (Python 3.13 is recommended)
|
|
55
|
+
- No GPU or internet connection for inference
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
python -m pip install voicesynth-voicegenerator
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
For development:
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
python -m pip install -e ".[test]"
|
|
67
|
+
python -m pip install -e ".[all]"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The install/distribution name is `voicesynth-voicegenerator`; imports and the
|
|
71
|
+
CLI remain `voicesynth`.
|
|
72
|
+
|
|
73
|
+
Optional extras:
|
|
74
|
+
|
|
75
|
+
- `training`: PyTorch and ONNX for optional prosody fitting/export
|
|
76
|
+
- `onnx`: ONNX Runtime CPU inference
|
|
77
|
+
- `realtime`: Windows-compatible sounddevice playback
|
|
78
|
+
- `mp3`: Python-accessible FFmpeg encoder
|
|
79
|
+
- `all`: all optional runtime components
|
|
80
|
+
- `test`: pytest
|
|
81
|
+
|
|
82
|
+
## CLI
|
|
83
|
+
|
|
84
|
+
```powershell
|
|
85
|
+
voicesynth init my_voice
|
|
86
|
+
voicesynth train add my_voice --audio recording.wav --text "Hello world"
|
|
87
|
+
voicesynth train import my_voice ./dataset --audio-dir audio
|
|
88
|
+
voicesynth train process my_voice
|
|
89
|
+
voicesynth generate my_voice --text "Hello world" --output hello.wav
|
|
90
|
+
voicesynth test my_voice
|
|
91
|
+
voicesynth info my_voice.vvoice
|
|
92
|
+
voicesynth validate my_voice.vvoice
|
|
93
|
+
voicesynth export my_voice --output my_export.vvoice
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Dataset metadata:
|
|
97
|
+
|
|
98
|
+
```csv
|
|
99
|
+
filename,text
|
|
100
|
+
001.wav,Hello there.
|
|
101
|
+
002.wav,How are you doing?
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Python API
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from voicesynth import Voice
|
|
108
|
+
|
|
109
|
+
with Voice.load("my_voice.vvoice") as voice:
|
|
110
|
+
audio = voice.generate("Hello world!", speed=1.0, pitch=0.0)
|
|
111
|
+
print(audio.duration, audio.diagnostics)
|
|
112
|
+
voice.save("Hello world", "hello.wav", format="wav")
|
|
113
|
+
for chunk in voice.generate_stream("Hello there", chunk_size=2400):
|
|
114
|
+
process_audio(chunk)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
MP3 export:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
voice.save("Hello", "hello.mp3", format="mp3", bitrate=192)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Realtime playback:
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
voice.speak("Hello world")
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Alignment and quality limitations
|
|
130
|
+
|
|
131
|
+
Voice lines are currently aligned with a duration estimate. It does not claim exact phoneme boundaries and clearly reports this as `heuristic-duration-estimate`. Missing ARPABET units are reported in generation diagnostics and are not replaced with unrelated recordings.
|
|
132
|
+
|
|
133
|
+
Forced alignment backend integration is optional. The built-in mode uses a
|
|
134
|
+
Viterbi-envelope duration estimate and is not claimed to be exact. Prosody
|
|
135
|
+
training produces a real PyTorch/ONNX model; when unavailable, deterministic
|
|
136
|
+
duration, pitch, pause, and concatenation rules remain explicit.
|
|
137
|
+
|
|
138
|
+
## Training a voice
|
|
139
|
+
|
|
140
|
+
For Google Colab, open [the Colab training guide](docs/colab-training.md) or
|
|
141
|
+
launch the notebook at [VoiceSynth_Colab_Training.ipynb](examples/VoiceSynth_Colab_Training.ipynb).
|
|
142
|
+
|
|
143
|
+
### Requirements
|
|
144
|
+
|
|
145
|
+
- Mono or stereo WAV, FLAC, or other SoundFile-supported audio
|
|
146
|
+
- A transcript for every recording
|
|
147
|
+
- 24 kHz synthesis output; source recordings are resampled automatically
|
|
148
|
+
- Quiet recordings improve unit extraction
|
|
149
|
+
- At least several complete sentences produce better coverage
|
|
150
|
+
- PyTorch is needed only for optional prosody training
|
|
151
|
+
|
|
152
|
+
### Individual recording workflow
|
|
153
|
+
|
|
154
|
+
```powershell
|
|
155
|
+
voicesynth init my_voice
|
|
156
|
+
voicesynth train add my_voice --audio ".\recordings\001.wav" --text "Hello world!"
|
|
157
|
+
voicesynth train add my_voice --audio ".\recordings\002.wav" --text "Welcome back."
|
|
158
|
+
voicesynth train process my_voice
|
|
159
|
+
voicesynth test my_voice
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Adding a recording updates that voicebank incrementally. It does not retrain
|
|
163
|
+
neural weights unless `voicesynth train prosody` is run.
|
|
164
|
+
|
|
165
|
+
### Dataset workflow
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
dataset\
|
|
169
|
+
metadata.csv
|
|
170
|
+
audio\
|
|
171
|
+
001.wav
|
|
172
|
+
002.wav
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```csv
|
|
176
|
+
filename,text
|
|
177
|
+
001.wav,Hello world!
|
|
178
|
+
002.wav,Welcome back.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```powershell
|
|
182
|
+
voicesynth train import my_voice .\dataset
|
|
183
|
+
voicesynth train import my_voice .\dataset --audio-dir audio
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Imports report imported recordings, failed recordings, duplicates, and missing
|
|
187
|
+
files. A failed recording does not create a successful unit and is included in
|
|
188
|
+
the exit status report.
|
|
189
|
+
|
|
190
|
+
### Optional prosody training
|
|
191
|
+
|
|
192
|
+
```powershell
|
|
193
|
+
python -m pip install -e ".[training]"
|
|
194
|
+
voicesynth train prosody my_voice
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This performs measurable PyTorch MSE training and exports `models/prosody.onnx`.
|
|
198
|
+
The first implementation uses recording duration, word count, character count,
|
|
199
|
+
and deterministic input features. A voicebank remains usable if training or ONNX
|
|
200
|
+
loading is unavailable.
|
|
201
|
+
|
|
202
|
+
## Publishing to PyPI
|
|
203
|
+
|
|
204
|
+
The package uses `pyproject.toml` and the `src/` layout.
|
|
205
|
+
|
|
206
|
+
```powershell
|
|
207
|
+
python -m pip install build twine
|
|
208
|
+
python -m build
|
|
209
|
+
python -m twine check dist/*
|
|
210
|
+
python -m twine upload --repository testpypi dist/*
|
|
211
|
+
python -m twine upload dist/*
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Before publishing:
|
|
215
|
+
|
|
216
|
+
1. Confirm the project name and URLs in `pyproject.toml` match your release.
|
|
217
|
+
2. Increase the `version` in `pyproject.toml`.
|
|
218
|
+
3. Test in a clean virtual environment:
|
|
219
|
+
|
|
220
|
+
```powershell
|
|
221
|
+
python -m venv .venv
|
|
222
|
+
.venv\Scripts\Activate.ps1
|
|
223
|
+
python -m pip install -e ".[test]"
|
|
224
|
+
python -m pytest
|
|
225
|
+
python -m pip wheel . --no-deps -w dist
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
4. Create a PyPI API token and configure `TWINE_USERNAME=__token__` plus
|
|
229
|
+
`TWINE_PASSWORD=<token>`. Do not commit credentials.
|
|
230
|
+
5. Test with TestPyPI first, then publish to PyPI.
|
|
231
|
+
|
|
232
|
+
### GitLab CI release automation
|
|
233
|
+
|
|
234
|
+
The included `.gitlab-ci.yml` tests the package, builds and checks wheel/sdist
|
|
235
|
+
artifacts, and deploys MkDocs to GitLab Pages from the default branch. A
|
|
236
|
+
semantic-version tag such as `v0.1.1` triggers the PyPI release job, provided
|
|
237
|
+
that it matches `project.version` in `pyproject.toml`.
|
|
238
|
+
|
|
239
|
+
Configure a PyPI Trusted Publisher for project `voicesynth-voicegenerator`
|
|
240
|
+
with GitLab namespace `goonlabs-group`, repository `voicesynth`, and pipeline
|
|
241
|
+
file `.gitlab-ci.yml`. The CI job uses OIDC and needs no PyPI token variable.
|
|
242
|
+
Protect release tags and restrict who can create them. The GitLab URLs are
|
|
243
|
+
configured for `goonlabs-group/voicesynth`.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# VoiceSynth
|
|
2
|
+
|
|
3
|
+
VoiceSynth is a local, installable hybrid unit-selection text-to-speech engine for English. It creates portable `.vvoice` archives from recordings and transcripts, generates mono 24 kHz PCM, exports WAV/MP3, and streams PCM chunks.
|
|
4
|
+
|
|
5
|
+
## End-to-end status
|
|
6
|
+
|
|
7
|
+
VoiceSynth provides real audio processing, unit extraction, archive export/import,
|
|
8
|
+
unit-selection synthesis, PCM streaming, WAV export, MP3 export, optional ONNX
|
|
9
|
+
prosody, and optional sounddevice playback. Alignment is explicitly reported:
|
|
10
|
+
voice lines use a Viterbi-envelope duration estimate and are not presented as
|
|
11
|
+
phoneme-accurate forced alignment.
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Windows 10/11 or another Python-capable platform
|
|
16
|
+
- Python 3.10+ (Python 3.13 is recommended)
|
|
17
|
+
- No GPU or internet connection for inference
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
python -m pip install voicesynth-voicegenerator
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For development:
|
|
26
|
+
|
|
27
|
+
```powershell
|
|
28
|
+
python -m pip install -e ".[test]"
|
|
29
|
+
python -m pip install -e ".[all]"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The install/distribution name is `voicesynth-voicegenerator`; imports and the
|
|
33
|
+
CLI remain `voicesynth`.
|
|
34
|
+
|
|
35
|
+
Optional extras:
|
|
36
|
+
|
|
37
|
+
- `training`: PyTorch and ONNX for optional prosody fitting/export
|
|
38
|
+
- `onnx`: ONNX Runtime CPU inference
|
|
39
|
+
- `realtime`: Windows-compatible sounddevice playback
|
|
40
|
+
- `mp3`: Python-accessible FFmpeg encoder
|
|
41
|
+
- `all`: all optional runtime components
|
|
42
|
+
- `test`: pytest
|
|
43
|
+
|
|
44
|
+
## CLI
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
voicesynth init my_voice
|
|
48
|
+
voicesynth train add my_voice --audio recording.wav --text "Hello world"
|
|
49
|
+
voicesynth train import my_voice ./dataset --audio-dir audio
|
|
50
|
+
voicesynth train process my_voice
|
|
51
|
+
voicesynth generate my_voice --text "Hello world" --output hello.wav
|
|
52
|
+
voicesynth test my_voice
|
|
53
|
+
voicesynth info my_voice.vvoice
|
|
54
|
+
voicesynth validate my_voice.vvoice
|
|
55
|
+
voicesynth export my_voice --output my_export.vvoice
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Dataset metadata:
|
|
59
|
+
|
|
60
|
+
```csv
|
|
61
|
+
filename,text
|
|
62
|
+
001.wav,Hello there.
|
|
63
|
+
002.wav,How are you doing?
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Python API
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from voicesynth import Voice
|
|
70
|
+
|
|
71
|
+
with Voice.load("my_voice.vvoice") as voice:
|
|
72
|
+
audio = voice.generate("Hello world!", speed=1.0, pitch=0.0)
|
|
73
|
+
print(audio.duration, audio.diagnostics)
|
|
74
|
+
voice.save("Hello world", "hello.wav", format="wav")
|
|
75
|
+
for chunk in voice.generate_stream("Hello there", chunk_size=2400):
|
|
76
|
+
process_audio(chunk)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
MP3 export:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
voice.save("Hello", "hello.mp3", format="mp3", bitrate=192)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Realtime playback:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
voice.speak("Hello world")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Alignment and quality limitations
|
|
92
|
+
|
|
93
|
+
Voice lines are currently aligned with a duration estimate. It does not claim exact phoneme boundaries and clearly reports this as `heuristic-duration-estimate`. Missing ARPABET units are reported in generation diagnostics and are not replaced with unrelated recordings.
|
|
94
|
+
|
|
95
|
+
Forced alignment backend integration is optional. The built-in mode uses a
|
|
96
|
+
Viterbi-envelope duration estimate and is not claimed to be exact. Prosody
|
|
97
|
+
training produces a real PyTorch/ONNX model; when unavailable, deterministic
|
|
98
|
+
duration, pitch, pause, and concatenation rules remain explicit.
|
|
99
|
+
|
|
100
|
+
## Training a voice
|
|
101
|
+
|
|
102
|
+
For Google Colab, open [the Colab training guide](docs/colab-training.md) or
|
|
103
|
+
launch the notebook at [VoiceSynth_Colab_Training.ipynb](examples/VoiceSynth_Colab_Training.ipynb).
|
|
104
|
+
|
|
105
|
+
### Requirements
|
|
106
|
+
|
|
107
|
+
- Mono or stereo WAV, FLAC, or other SoundFile-supported audio
|
|
108
|
+
- A transcript for every recording
|
|
109
|
+
- 24 kHz synthesis output; source recordings are resampled automatically
|
|
110
|
+
- Quiet recordings improve unit extraction
|
|
111
|
+
- At least several complete sentences produce better coverage
|
|
112
|
+
- PyTorch is needed only for optional prosody training
|
|
113
|
+
|
|
114
|
+
### Individual recording workflow
|
|
115
|
+
|
|
116
|
+
```powershell
|
|
117
|
+
voicesynth init my_voice
|
|
118
|
+
voicesynth train add my_voice --audio ".\recordings\001.wav" --text "Hello world!"
|
|
119
|
+
voicesynth train add my_voice --audio ".\recordings\002.wav" --text "Welcome back."
|
|
120
|
+
voicesynth train process my_voice
|
|
121
|
+
voicesynth test my_voice
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Adding a recording updates that voicebank incrementally. It does not retrain
|
|
125
|
+
neural weights unless `voicesynth train prosody` is run.
|
|
126
|
+
|
|
127
|
+
### Dataset workflow
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
dataset\
|
|
131
|
+
metadata.csv
|
|
132
|
+
audio\
|
|
133
|
+
001.wav
|
|
134
|
+
002.wav
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```csv
|
|
138
|
+
filename,text
|
|
139
|
+
001.wav,Hello world!
|
|
140
|
+
002.wav,Welcome back.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```powershell
|
|
144
|
+
voicesynth train import my_voice .\dataset
|
|
145
|
+
voicesynth train import my_voice .\dataset --audio-dir audio
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Imports report imported recordings, failed recordings, duplicates, and missing
|
|
149
|
+
files. A failed recording does not create a successful unit and is included in
|
|
150
|
+
the exit status report.
|
|
151
|
+
|
|
152
|
+
### Optional prosody training
|
|
153
|
+
|
|
154
|
+
```powershell
|
|
155
|
+
python -m pip install -e ".[training]"
|
|
156
|
+
voicesynth train prosody my_voice
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This performs measurable PyTorch MSE training and exports `models/prosody.onnx`.
|
|
160
|
+
The first implementation uses recording duration, word count, character count,
|
|
161
|
+
and deterministic input features. A voicebank remains usable if training or ONNX
|
|
162
|
+
loading is unavailable.
|
|
163
|
+
|
|
164
|
+
## Publishing to PyPI
|
|
165
|
+
|
|
166
|
+
The package uses `pyproject.toml` and the `src/` layout.
|
|
167
|
+
|
|
168
|
+
```powershell
|
|
169
|
+
python -m pip install build twine
|
|
170
|
+
python -m build
|
|
171
|
+
python -m twine check dist/*
|
|
172
|
+
python -m twine upload --repository testpypi dist/*
|
|
173
|
+
python -m twine upload dist/*
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Before publishing:
|
|
177
|
+
|
|
178
|
+
1. Confirm the project name and URLs in `pyproject.toml` match your release.
|
|
179
|
+
2. Increase the `version` in `pyproject.toml`.
|
|
180
|
+
3. Test in a clean virtual environment:
|
|
181
|
+
|
|
182
|
+
```powershell
|
|
183
|
+
python -m venv .venv
|
|
184
|
+
.venv\Scripts\Activate.ps1
|
|
185
|
+
python -m pip install -e ".[test]"
|
|
186
|
+
python -m pytest
|
|
187
|
+
python -m pip wheel . --no-deps -w dist
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
4. Create a PyPI API token and configure `TWINE_USERNAME=__token__` plus
|
|
191
|
+
`TWINE_PASSWORD=<token>`. Do not commit credentials.
|
|
192
|
+
5. Test with TestPyPI first, then publish to PyPI.
|
|
193
|
+
|
|
194
|
+
### GitLab CI release automation
|
|
195
|
+
|
|
196
|
+
The included `.gitlab-ci.yml` tests the package, builds and checks wheel/sdist
|
|
197
|
+
artifacts, and deploys MkDocs to GitLab Pages from the default branch. A
|
|
198
|
+
semantic-version tag such as `v0.1.1` triggers the PyPI release job, provided
|
|
199
|
+
that it matches `project.version` in `pyproject.toml`.
|
|
200
|
+
|
|
201
|
+
Configure a PyPI Trusted Publisher for project `voicesynth-voicegenerator`
|
|
202
|
+
with GitLab namespace `goonlabs-group`, repository `voicesynth`, and pipeline
|
|
203
|
+
file `.gitlab-ci.yml`. The CI job uses OIDC and needs no PyPI token variable.
|
|
204
|
+
Protect release tags and restrict who can create them. The GitLab URLs are
|
|
205
|
+
configured for `goonlabs-group/voicesynth`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
VoiceSynth uses an offline text-to-unit pipeline:
|
|
4
|
+
|
|
5
|
+
1. English text normalization and ARPABET-style phonemization.
|
|
6
|
+
2. 24 kHz mono recording ingestion and waveform trimming.
|
|
7
|
+
3. Duration-estimated phoneme unit segmentation.
|
|
8
|
+
4. Unit lookup and concatenative rendering.
|
|
9
|
+
5. WAV or MP3 export and optional streaming/playback.
|
|
10
|
+
|
|
11
|
+
Each `.vvoice` archive is a validated ZIP containing a manifest, metadata,
|
|
12
|
+
phoneme index, and unit WAV files.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Audio engine
|
|
2
|
+
|
|
3
|
+
The engine stores and renders mono float32 PCM at 24 kHz. SoundFile reads
|
|
4
|
+
supported source formats and SciPy performs resampling. Training normalizes
|
|
5
|
+
peak level and trims low-energy leading/trailing regions before indexing units.
|
|
6
|
+
|
|
7
|
+
Synthesis selects recorded units using phone and available adjacent-phone
|
|
8
|
+
context, applies speed/pitch controls, and joins the resulting segments.
|
|
9
|
+
Diagnostics identify missing phonemes and timing estimates. Units are not
|
|
10
|
+
replaced with unrelated recordings.
|
|
11
|
+
|
|
12
|
+
WAV export is available in the base install. MP3 export uses the `mp3` optional
|
|
13
|
+
extra and its Python-accessible FFmpeg binary. MP3 encoding is a post-render
|
|
14
|
+
operation.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# CLI
|
|
2
|
+
|
|
3
|
+
```powershell
|
|
4
|
+
voicesynth init demo
|
|
5
|
+
voicesynth train add demo --audio line.wav --text "Hello world"
|
|
6
|
+
voicesynth train import demo dataset
|
|
7
|
+
voicesynth generate demo --text "Hello world" --output hello.wav
|
|
8
|
+
voicesynth test demo
|
|
9
|
+
voicesynth info demo.vvoice
|
|
10
|
+
voicesynth validate demo.vvoice
|
|
11
|
+
```
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Train a VoiceBank in Google Colab
|
|
2
|
+
|
|
3
|
+
The notebook at
|
|
4
|
+
[`examples/VoiceSynth_Colab_Training.ipynb`](https://gitlab.com/goonlabs-group/voicesynth/-/blob/main/examples/VoiceSynth_Colab_Training.ipynb)
|
|
5
|
+
walks through installation, Drive setup, dataset validation, `.vvoice` creation,
|
|
6
|
+
optional prosody fitting, synthesis, playback, and saving the finished model.
|
|
7
|
+
|
|
8
|
+
Download that `.ipynb` file, then use **File → Upload notebook** in Google Colab.
|
|
9
|
+
|
|
10
|
+
## What Colab is useful for
|
|
11
|
+
|
|
12
|
+
Colab is a convenient Linux environment for preparing and processing datasets.
|
|
13
|
+
The current voicebank engine does **not** train a large neural speech model and
|
|
14
|
+
does not require a GPU. The optional prosody helper is a small PyTorch
|
|
15
|
+
duration/pitch regressor exported to ONNX; GPU acceleration is usually
|
|
16
|
+
unnecessary.
|
|
17
|
+
|
|
18
|
+
Colab does not host the trained model automatically. Mount Google Drive and
|
|
19
|
+
write the output `.vvoice` there or download it before the runtime is reset.
|
|
20
|
+
|
|
21
|
+
## Before starting
|
|
22
|
+
|
|
23
|
+
1. Prepare recordings and transcripts you have permission to use.
|
|
24
|
+
2. Put them into a Drive folder like:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
MyDrive/voicesynth-dataset/
|
|
28
|
+
metadata.csv
|
|
29
|
+
audio/
|
|
30
|
+
001.wav
|
|
31
|
+
002.wav
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
3. Use a CSV with exact `filename,text` columns:
|
|
35
|
+
|
|
36
|
+
```csv
|
|
37
|
+
filename,text
|
|
38
|
+
001.wav,Hello there.
|
|
39
|
+
002.wav,Welcome back.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
4. Download the notebook, upload it to Colab, and set its repository URL to your GitLab
|
|
43
|
+
repository. The repository must be public for the notebook's simple
|
|
44
|
+
`git clone` cell. For private repositories, upload the source ZIP to Drive
|
|
45
|
+
and update the install cell to point at the extracted folder; do not put a
|
|
46
|
+
long-lived access token directly into a notebook.
|
|
47
|
+
|
|
48
|
+
## Notebook workflow
|
|
49
|
+
|
|
50
|
+
1. Clone the source and install the project with its training extra.
|
|
51
|
+
2. Mount Drive and set the dataset and output paths.
|
|
52
|
+
3. Import the CSV dataset into a voicebank.
|
|
53
|
+
4. Inspect the report and fail if any clips did not import.
|
|
54
|
+
5. Optionally fit and package the small prosody model.
|
|
55
|
+
6. Synthesize a test sentence, listen in Colab, and save the `.vvoice` to Drive.
|
|
56
|
+
|
|
57
|
+
The notebook reports missing units and limitations. A Colab GPU does not
|
|
58
|
+
improve concatenative synthesis, and it does not convert the voicebank into a
|
|
59
|
+
large neural TTS model.
|
|
60
|
+
|
|
61
|
+
## Reproducibility and limits
|
|
62
|
+
|
|
63
|
+
- Save the notebook output, dataset revision, and resulting `.vvoice` together.
|
|
64
|
+
- The package currently estimates phone durations; it does not claim
|
|
65
|
+
phoneme-accurate forced alignment.
|
|
66
|
+
- Transcripts, number normalization, and dictionary coverage affect which
|
|
67
|
+
units are extracted.
|
|
68
|
+
- For inference, download the `.vvoice` and install the lightweight runtime
|
|
69
|
+
locally. Inference is CPU-compatible and does not require PyTorch.
|