Metadata-Version: 2.4
Name: dtl-text-to-speech
Version: 1.0.4
Summary: PTTS wrapper script that transforms dialogues from text to speech using multiple voices and models, and stitches the generated sounds together using PyDub. Useful for making audiobooks.
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ptts
Requires-Dist: pydub>=0.25.1
Requires-Dist: audioop-lts
Requires-Dist: pyyaml>=6.0.4
Dynamic: license-file

# text-to-speech utility

PTTS wrapper script that transforms dialogues from text to speech using multiple voices and models, and stitches the
generated sounds together using PyDub.

Useful for making audiobooks.

See the [GitHub page](https://github.com/fx89/text-to-speech).

## References:

### PTTS

This script relies on Gradium AI's PTTS for voice generation. See more details
at [the project's GitHub page](https://github.com/gradium-ai/xn-ptts).

### PyDub

This script uses PyDub to stitch together audio files generated by PTTS. See more details
at [the project's GitHub page](https://github.com/jiaaro/pydub/).

### Phonon 31m

The Phonon 31m model and names of voices provided by Gradium through
the [Phonon voices catalog](https://huggingface.co/gradium/phonon-voices/tree/main/voices) are referenced in the example
that comes with this script, as well as in this readme file. The default voice is copied into the example project. The
model can be used under the Apache 2.0 license and can be downloaded free of charge
from [Hugging Face](https://huggingface.co/gradium/phonon-31m-en).

## Installing

### Virtual environment

To avoid dependency conflicts, it is recommended to set up a new virtual environment for the script. For example:

```
python -m venv /path/to/new/virtual/environment
OR
python3 -m venv /path/to/new/virtual/environment
```

To activate the environment, run

```
source /path/to/new/virtual/environment/bin/activate
```

### Downloading the text-to-speech utility

To download and install the package, run

```
python -m pip install dtl-text-to-speech
```

### Optional Phonon TTS models

Text-to-speech projects can make use of multiple models such as Phonon 31m, Phonon 40m and anything else that may be
derived from the two or may be used in the future with PTTS.

These models can be downloaded into local directories that can be referenced from the text-to-speech project.

## Example project

## Running

### Activating the Python environment

This step is necessary for any of the following steps

```
source /path/to/new/virtual/environment/bin/activate
```

### Listing available voices

The following command can be used to list the voices available in the default voices catalog. This just wraps over the
--list-voices functionality of PTTS.

```
text-to-speech list-catgalog-voices
```

The following command can be used to list the voices available in a given model. This just wraps over the --list-voices
functionality of PTTS.

```
text-to-speech list-voices [optional-model-path] 
```

### Running the tts transformation on a project directory

Use the following command to create a new project in a given target path
```
text-to-speech new-project <path-to-project-dir>
```

Use the following command to run on a project directory

```
text-to-speech transform <path-to-project-dir>
```

Take a look at the `example-project` directory in this repository to understand what a project directory is supposed to
contain

