forked from VRCWizard/glados-tts-voice-wizard
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start making things more pythonic, use poetry and structure as a modu…
…le, PEP8 compliance and summing up goals and changes in README (#1) changing tabs to spaces a quick summary of the fork in README.me fixes to the README use pysoundfile instead of scipy poetry package, initial standard python structure double spaces to four spaces flake8 config autopep8 --in-place auto fixes markdown fixes in README pimping up the README a little bit remove sample output.wav .gitkeep the audio/ dir
- Loading branch information
1 parent
617fe89
commit fe2554a
Showing
27 changed files
with
2,385 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[flake8] | ||
# E501 line too long | ||
# W503 line break before binary operator | ||
# W504 line break after binary operator | ||
#ignore = E501,W503,W504 | ||
exclude = | ||
max-line-length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
**/__pycache__/** | ||
__pycache__/ | ||
dist/ | ||
glados_tts.egg-info/ | ||
*.pyc | ||
|
||
audio/* | ||
!audio/.gitkeep | ||
*.wav | ||
audio/* | ||
|
||
*~ | ||
.#* | ||
\#* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,101 @@ | ||
# GLaDOS Text-to-speech (TTS) Voice Generator | ||
Neural network based TTS Engine. | ||
|
||
If you want to just play around with the TTS, this works as stand-alone. | ||
```console | ||
python glados-tts/glados.py | ||
``` | ||
|
||
the TTS Engine can also be used remotely on a machine more powerful then the Pi to process in house TTS: (executed from glados-tts directory | ||
```console | ||
python engine-remote.py | ||
``` | ||
|
||
Default port is 8124 | ||
Be sure to update settings.env variable in your main Glados-voice-assistant directory: | ||
``` | ||
TTS_ENGINE_API = http://192.168.1.3:8124/synthesize/ | ||
``` | ||
[![Build Status](https://jenkins.sudo.is/buildStatus/icon?job=ben%2Fglados-tts%2Fmain&style=flat-square)](https://jenkins.sudo.is/job/ben/job/glados-tts/) | ||
[![git](https://git.sudo.is/shieldsio/static/v1?label=git&message=git.sudo.is/ben/glados-tts&logo=gitea&style=flat-square&logoWidth=20&color=darkgreen)](https://git.sudo.is/ben/glados-tts) | ||
[![github](https://git.sudo.is/shieldsio/static/v1?label=github&message=benediktkr/glados-tts&logo=github&style=flat-square&logoWidth=20&color=darkgreen)](https://github.com/benediktkr/glados-tts) | ||
[![MIT](https://git.sudo.is/shieldsio/badge/license-MIT-blue?style=flat-square)](LICENSE) | ||
|
||
Neural network based TTS Engine. | ||
|
||
## Description | ||
The initial, regular Tacotron model was trained first on LJSpeech, and then on a heavily modified version of the Ellen McClain dataset (all non-Portal 2 voice lines removed, punctuation added). | ||
The initial, regular Tacotron model was trained first on LJSpeech, and | ||
then on a heavily modified version of the Ellen McClain dataset (all | ||
non-Portal 2 voice lines removed, punctuation added). | ||
|
||
* The Forward Tacotron model was only trained on about 600 voice lines. | ||
* The HiFiGAN model was generated through transfer learning from the sample. | ||
* All models have been optimized and quantized. | ||
|
||
## Notes about this fork | ||
|
||
Forked by [`ben`](https://git.sudo.is/ben) (:github: [`@benediktkr`](https://github.com/benediktkr)) from | ||
[`github:VRCWizard/glados-tts-voice-wizard`](https://github.com/VRCWizard/glados-tts-voice-wizard), | ||
which in turn was a fork of | ||
[`github:R2D2FISH/glados-tts`](https://github.com/R2D2FISH/glados-tts). | ||
|
||
## Installation Instruction | ||
If you want to install the TTS Engine on your machine, please follow the steps | ||
below. | ||
This fork modernizes and improves the Python code in the project and does a bunch of housekeeping. | ||
|
||
1. Install [`python 3.7.9`](https://www.python.org/downloads/release/python-379/). | ||
If you have to deal with multiple versions of python then you may find [`pyenv-win`](https://pypi.org/project/pyenv-win/) extremely helpful | ||
|
||
- [pyenv quickstart guide](https://github.com/pyenv-win/pyenv-win#quick-start) | ||
|
||
![image](https://user-images.githubusercontent.com/101527472/225459133-9075a959-1d7b-4c77-a017-164fa242acbd.png) | ||
(pytorch will not install correctly if using 32 bit version) | ||
* `[DONE]`: Gets rid of the `SciPy` dependency (replaced with the more modern and lightwight [`pysoundfile`](https://github.com/gooofy/py-espeak-ng) (since all it was used for was writing a `.wav` file to disk) | ||
* `[DONE]`: Support modern stable Python 3 versions, and update dependencies. | ||
* `[DONE]`: Versioned packages with `poetry` and `pyproject.toml` | ||
* `[WIP]`: Python coding style and code quality improvements (proper handling of `file` object, improved logging..) | ||
* `[TODO]`: Support Home Assistant through the [`notify` integration](https://www.home-assistant.io/integrations/notify/) | ||
* `[TODO]`: Configuration handling with `click`. | ||
* `[TODO]`: Better logging with `loguru` | ||
* `[TODO]`: Using `waitress` as a WSGI-server for production-capable deployments | ||
* `[TODO]`: Docker support | ||
* `[TODO]`: see if its possible to avoid `espeak-ng` as a system package dependency (python bindings, buliding the C library, etc) | ||
|
||
|
||
2. Install the [`espeak`](https://github.com/espeak-ng/espeak-ng) synthesizer | ||
according to the [installation | ||
instructions](https://github.com/espeak-ng/espeak-ng/blob/master/docs/guide.md) | ||
for your operating system. | ||
3. Using console (all commands will be typed into console) | ||
- open "terminal" or "command prompt" | ||
![image](https://user-images.githubusercontent.com/101527472/215557319-1b7f04e0-eabf-4830-b305-2c31922e037f.png) | ||
No work on the speech model itself is expected. | ||
|
||
- Change Directory or "cd" into the correct folder with engine-TTSVoiceWizard.py in it, here is an example: | ||
### Home Assistant `notify` service | ||
|
||
```console | ||
cd C:\Users\<NAME>\Downloads\glados-tts-voice-wizard-main\glados-tts-voice-wizard-main | ||
configuration in `configuration.yaml` (or a `package/`): | ||
|
||
```yaml | ||
# Enable rest api | ||
api: | ||
|
||
notify: | ||
- name: glados | ||
platform: rest | ||
resource: http://${GLADOS}/notify | ||
``` | ||
4. type this command into console to see if the correct version of python is installed and working correctly. | ||
```console | ||
python --version | ||
This is roughly how it would work (not done yet). | ||
## Install | ||
First you need to [install the `espeak-ng` system | ||
packages](https://github.com/espeak-ng/espeak-ng/blob/master/docs/guide.md). | ||
|
||
```shell | ||
# for debian/ubuntu: | ||
sudo apt-get install espeak-ng | ||
# for fedora/amazon: | ||
sudo yum install espeak-ng | ||
``` | ||
- if you get an error that mentions "app execution aliases", simily turn them off for python in the windows settings | ||
|
||
![image](https://user-images.githubusercontent.com/101527472/225462429-592cfb3b-ee28-4355-9d71-84466aa36a09.png) | ||
|
||
5. Install the required Python packages, e.g., by running `pip install -r | ||
requirements.txt` | ||
- if it says that pip is not a recognized command use `python -m pip install -r requirements.txt` instead | ||
- if it still says pip is not recognized then one of the solutions here is guarrenteed to help (if you ask for help with this issue I will literally tell you a solution verbatium from this page) https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-command | ||
|
||
5. Set the required environment variables by running | ||
```console | ||
setx PHONEMIZER_ESPEAK_LIBRARY 'C:\Program Files\eSpeak NG\libespeak-ng.dll' | ||
setx PHONEMIZER_ESPEAK_PATH 'C:\Program Files\eSpeak NG\espeak-ng.exe' | ||
|
||
This can hopefully be improved in the future. There is a Python | ||
bindings for `espeak` (at a glance, found | ||
[`py-espeak-ng`](https://github.com/gooofy/py-espeak-ng)). | ||
|
||
Then install the poetry-managed virtualenv | ||
|
||
```shell | ||
poetry install | ||
``` | ||
|
||
- If those commands don't work you may have to add the environment variables manually. | ||
- You can add them to system variables like this picture. If you are unsure how to do this... google "how to set environment variables" | ||
|
||
![image](https://user-images.githubusercontent.com/101527472/216216742-45f96ff7-d9ad-4c32-8063-6ae93fc11ede.png) | ||
## Usage | ||
|
||
If you want to just play around with the TTS, works on the shell: | ||
|
||
```shell | ||
poetry run python3 glados.py | ||
``` | ||
|
||
|
||
## TTS Voice Wizard Instructions | ||
- Follow the above installation instructions | ||
- To use glados TTS for TTS Voice Wizard run this (it will need to be running in the background for Glados TTS to work in TTS Voice Wizard) | ||
- open console | ||
- Change Directory or "cd" into the correct folder with engine-TTSVoiceWizard.py in it, here is an example: | ||
The TTS engine can also run as a web server: | ||
|
||
```console | ||
cd C:\Users\<NAME>\Downloads\glados-tts-voice-wizard-main\glados-tts-voice-wizard-main | ||
```shell | ||
poetry run python3 engine.py | ||
``` | ||
- Run the python script | ||
```console | ||
python engine-TTSVoiceWizard.py | ||
|
||
Default port is 8124 | ||
Be sure to update settings.env variable in your main Glados-voice-assistant directory: | ||
``` | ||
Note you will have to have this script running background whenever you wanna use the glados voice. | ||
**Becareful sharing screen for help, when the script is successfully run it will show your ip address with the port being used** | ||
TTS_ENGINE_API = http://192.168.1.3:8124/synthesize/ | ||
``` | ||
|
||
![chell](chell.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# GLaDOS Text-to-speech (TTS) Voice Generator | ||
Neural network based TTS Engine. | ||
|
||
If you want to just play around with the TTS, this works as stand-alone. | ||
```console | ||
python glados-tts/glados.py | ||
``` | ||
|
||
the TTS Engine can also be used remotely on a machine more powerful then the Pi to process in house TTS: (executed from glados-tts directory | ||
```console | ||
python engine-remote.py | ||
``` | ||
|
||
Default port is 8124 | ||
Be sure to update settings.env variable in your main Glados-voice-assistant directory: | ||
``` | ||
TTS_ENGINE_API = http://192.168.1.3:8124/synthesize/ | ||
``` | ||
|
||
|
||
## Description | ||
The initial, regular Tacotron model was trained first on LJSpeech, and then on a heavily modified version of the Ellen McClain dataset (all non-Portal 2 voice lines removed, punctuation added). | ||
|
||
* The Forward Tacotron model was only trained on about 600 voice lines. | ||
* The HiFiGAN model was generated through transfer learning from the sample. | ||
* All models have been optimized and quantized. | ||
|
||
|
||
|
||
## Installation Instruction | ||
If you want to install the TTS Engine on your machine, please follow the steps | ||
below. | ||
|
||
1. Install [`python 3.7.9`](https://www.python.org/downloads/release/python-379/). | ||
If you have to deal with multiple versions of python then you may find [`pyenv-win`](https://pypi.org/project/pyenv-win/) extremely helpful | ||
|
||
- [pyenv quickstart guide](https://github.com/pyenv-win/pyenv-win#quick-start) | ||
|
||
![image](https://user-images.githubusercontent.com/101527472/225459133-9075a959-1d7b-4c77-a017-164fa242acbd.png) | ||
(pytorch will not install correctly if using 32 bit version) | ||
|
||
|
||
2. Install the [`espeak`](https://github.com/espeak-ng/espeak-ng) synthesizer | ||
according to the [installation | ||
instructions](https://github.com/espeak-ng/espeak-ng/blob/master/docs/guide.md) | ||
for your operating system. | ||
3. Using console (all commands will be typed into console) | ||
- open "terminal" or "command prompt" | ||
![image](https://user-images.githubusercontent.com/101527472/215557319-1b7f04e0-eabf-4830-b305-2c31922e037f.png) | ||
|
||
- Change Directory or "cd" into the correct folder with engine-TTSVoiceWizard.py in it, here is an example: | ||
|
||
```console | ||
cd C:\Users\<NAME>\Downloads\glados-tts-voice-wizard-main\glados-tts-voice-wizard-main | ||
``` | ||
4. type this command into console to see if the correct version of python is installed and working correctly. | ||
```console | ||
python --version | ||
``` | ||
- if you get an error that mentions "app execution aliases", simily turn them off for python in the windows settings | ||
|
||
![image](https://user-images.githubusercontent.com/101527472/225462429-592cfb3b-ee28-4355-9d71-84466aa36a09.png) | ||
|
||
5. Install the required Python packages, e.g., by running `pip install -r | ||
requirements.txt` | ||
- if it says that pip is not a recognized command use `python -m pip install -r requirements.txt` instead | ||
- if it still says pip is not recognized then one of the solutions here is guarrenteed to help (if you ask for help with this issue I will literally tell you a solution verbatium from this page) https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-command | ||
|
||
5. Set the required environment variables by running | ||
```console | ||
setx PHONEMIZER_ESPEAK_LIBRARY 'C:\Program Files\eSpeak NG\libespeak-ng.dll' | ||
setx PHONEMIZER_ESPEAK_PATH 'C:\Program Files\eSpeak NG\espeak-ng.exe' | ||
``` | ||
|
||
- If those commands don't work you may have to add the environment variables manually. | ||
- You can add them to system variables like this picture. If you are unsure how to do this... google "how to set environment variables" | ||
|
||
![image](https://user-images.githubusercontent.com/101527472/216216742-45f96ff7-d9ad-4c32-8063-6ae93fc11ede.png) | ||
|
||
|
||
|
||
|
||
## TTS Voice Wizard Instructions | ||
- Follow the above installation instructions | ||
- To use glados TTS for TTS Voice Wizard run this (it will need to be running in the background for Glados TTS to work in TTS Voice Wizard) | ||
- open console | ||
- Change Directory or "cd" into the correct folder with engine-TTSVoiceWizard.py in it, here is an example: | ||
|
||
```console | ||
cd C:\Users\<NAME>\Downloads\glados-tts-voice-wizard-main\glados-tts-voice-wizard-main | ||
``` | ||
- Run the python script | ||
```console | ||
python engine-TTSVoiceWizard.py | ||
``` | ||
Note you will have to have this script running background whenever you wanna use the glados voice. | ||
**Becareful sharing screen for help, when the script is successfully run it will show your ip address with the port being used** |
File renamed without changes.
Binary file not shown.
Oops, something went wrong.