Metadata-Version: 2.1
Name: en-tts
Version: 0.0.2
Summary: Web app, command-line interface and Python library for synthesizing English texts into speech.
Author-email: Stefan Taubert <pypi@stefantaubert.com>
Maintainer-email: Stefan Taubert <pypi@stefantaubert.com>
License: MIT
Project-URL: Homepage, https://github.com/stefantaubert/en-tts
Project-URL: Issues, https://github.com/stefantaubert/en-tts/issues
Keywords: Text-to-speech,Speech synthesis,praat,TextGrid,Utils,Language,Linguistics
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Operating System :: OS Independent
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: BSD
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Unix
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Requires-Python: <3.12,>=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.18.5
Requires-Dist: tqdm>=4.63.0
Requires-Dist: ordered_set>=4.1.0
Requires-Dist: ffmpy>=0.2.3
Requires-Dist: nltk>=3.2.4
Requires-Dist: torch>=2.0.0
Requires-Dist: pronunciation-dictionary>=0.0.6
Requires-Dist: pronunciation-dictionary-utils>=0.0.5
Requires-Dist: english-text-normalization>=0.0.3
Requires-Dist: dict-from-dict>=0.0.4
Requires-Dist: dict-from-g2pe>=0.0.2
Requires-Dist: tacotron-cli>=0.0.5
Requires-Dist: waveglow-cli>=0.0.2
Requires-Dist: txt-utils>=0.0.3
Requires-Dist: gradio[oauth]>=4.26.0
Requires-Dist: uvicorn>=0.14.0

# en-tts

[![PyPI](https://img.shields.io/pypi/v/en-tts.svg)](https://pypi.python.org/pypi/en-tts)
![PyPI](https://img.shields.io/pypi/pyversions/en-tts.svg)
[![Hugging Face 🤗](https://img.shields.io/badge/%20%F0%9F%A4%97_Hugging_Face-en--tts-blue.svg)](https://huggingface.co/spaces/stefantaubert/en-tts)
[![pytorch](https://img.shields.io/badge/PyTorch_2.0+-ee4c2c?logo=pytorch&logoColor=white)](https://pytorch.org/get-started/pytorch-2.0/)
[![MIT](https://img.shields.io/github/license/stefantaubert/en-tts.svg)](https://github.com/stefantaubert/en-tts/blob/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/wheel/en-tts.svg)](https://pypi.python.org/pypi/en-tts/#files)
![PyPI](https://img.shields.io/pypi/implementation/en-tts.svg)
[![PyPI](https://img.shields.io/github/commits-since/stefantaubert/en-tts/latest/master.svg)](https://github.com/stefantaubert/en-tts/compare/v0.0.2...master)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.11032264.svg)](https://doi.org/10.5281/zenodo.11032264)

Web app, command-line interface and Python library for synthesizing English texts into speech.

## Installation

```sh
pip install en-tts --user
```

## Usage as web app

Visit [🤗 Hugging Face](https://huggingface.co/spaces/stefantaubert/en-tts) for a live demo.

<a href="https://huggingface.co/spaces/stefantaubert/en-tts">
<img src="https://github.com/stefantaubert/en-tts/raw/master/img/hf.png" alt="Screenshot Hugging Face" style="max-width: 600px; width: 100%"/>
</a>

You can also run it locally be executing `en-tts-web` in CLI and opening your browser on [http://127.0.0.1:7860](http://127.0.0.1:7860).

## Usage as CLI

```sh
en-tts-cli synthesize "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow."
```

The output can be listened [here](https://github.com/stefantaubert/en-tts/raw/master/examples/rainbow.wav).

## Usage as library

```py
from pathlib import Path
from tempfile import gettempdir

from en_tts import Synthesizer, Transcriber, normalize_audio, save_audio

text = "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow."

transcriber = Transcriber()
synthesizer = Synthesizer()

text_ipa = transcriber.transcribe_to_ipa(text)
audio = synthesizer.synthesize(text_ipa)

tmp_dir = Path(gettempdir())
save_audio(audio, tmp_dir / "output.wav")

# Optional: normalize output
normalize_audio(tmp_dir / "output.wav", tmp_dir / "output_norm.wav")
```

## Model info

The used TTS model is published [here](https://zenodo.org/records/10107104).

Evaluation results:

- MOS naturalness: 3.55 ± 0.28 (GT: 4.17 ± 0.23)
- MOS intelligibility: 4.44 ± 0.24 (GT: 4.63 ± 0.19)
- Mean MCD-DTW: 29.15
- Mean penalty: 0.1018

### Phoneme set

- Vowels: i, u, æ, ɑ, ɔ, ə, ɛ, ɪ, ʊ, ʌ
- Diphthongs: aɪ, aʊ, eɪ, oʊ, ɔɪ
- R-colored vowels: ɔr, ər, ɛr, ɪr, ʊr, ʌr
- Consonants: b, d, dʒ, f, h, j, k, l, m, n, p, r, s, t, tʃ, v, w, z, ð, ŋ, ɡ, ʃ, θ
- Breaks:
  - SIL0 (no break)
  - SIL1 (short break)
  - SIL2 (break)
  - SIL3 (long break)
- Special characters: . ? ! , : ; - — " ' ( ) [ ]

Each vowel, diphthong, r-colored vowel and consonant can have one of these duration markers:

- ˘ -> very short, e.g., oʊ˘
- nothing -> normal, e.g., oʊ
- ˑ -> half long, e.g., oʊˑ
- ː -> long, e.g., oʊː

Furthermore, each vowel, diphthong and r-colored vowel can have a leading stress symbol attached:

- ˈ -> primary stress, e.g., ˈoʊ
- ˌ -> secondary stress, e.g., ˌoʊ
- nothing -> no stress, e.g., oʊ

Stress and duration markers can be combined, e.g., ˌoʊː

## Citation

If you want to cite this repo, you can use the BibTeX-entry generated by GitHub (see *About => Cite this repository*).

- Taubert, S. (2024). en-tts (Version 0.0.2) [Computer software]. [https://doi.org/10.5281/zenodo.11032264](https://doi.org/10.5281/zenodo.11032264)

## Acknowledgments

Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 416228727 – CRC 1410

The authors gratefully acknowledge the GWK support for funding this project by providing computing time through the Center for Information Services and HPC (ZIH) at TU Dresden.

The authors are grateful to the Center for Information Services and High Performance Computing [Zentrum fur Informationsdienste und Hochleistungsrechnen (ZIH)] at TU Dresden for providing its facilities for high throughput calculations.
