Skip to content

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasnewman committed Dec 1, 2024
1 parent 26d1a8c commit 6861088
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,22 @@ F5 is an evolution of [E2 TTS](https://arxiv.org/abs/2406.18009v2) and improves
pip install f5-tts-mlx
```

## Usage
## Basic Usage

```bash
python -m f5_tts_mlx.generate --text "The quick brown fox jumped over the lazy dog."
```

You can also use a pipe to generate speech from the output of another process, for instance from a language model:

```bash
mlx_lm.generate --model mlx-community/Llama-3.2-1B-Instruct-4bit --verbose false \
--prompt "Write a concise paragraph explaning wavelets as used in signal processing." \
| python -m f5_tts_mlx.generate
```

## Voice Matching

If you want to use your own reference audio sample, make sure it's a mono, 24kHz wav file of around 5-10 seconds:

```bash
Expand All @@ -39,9 +49,9 @@ ffmpeg -i /path/to/audio.wav -ac 1 -ar 24000 -sample_fmt s16 -t 10 /path/to/outp

See [here](./f5_tts_mlx) for more options to customize generation.

## From Python

You can load a pretrained model from Python like this:
You can load a pretrained model from Python:

```python
from f5_tts_mlx.generate import generate
Expand Down
6 changes: 4 additions & 2 deletions f5_tts_mlx/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ def generate(
if output_path is not None:
sf.write(output_path, np.array(wave), SAMPLE_RATE)

player.stop()
if player is not None:
player.stop()
else:
start_date = datetime.datetime.now()

Expand Down Expand Up @@ -229,7 +230,8 @@ def generate(
if output_path is not None:
sf.write(output_path, np.array(wave), SAMPLE_RATE)

player.stop()
if player is not None:
player.stop()


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "f5-tts-mlx"
version = "0.1.9"
version = "0.2.0"
authors = [{name = "Lucas Newman", email = "[email protected]"}]
license = {text = "MIT"}
description = "F5-TTS - MLX"
Expand Down

0 comments on commit 6861088

Please sign in to comment.