chore: remove $ from examples on readme

This commit is contained in:
Ayo Ayco 2025-09-05 09:17:31 +02:00
parent 73bd8eb5e6
commit 5d4b56002b

View file

@ -10,17 +10,17 @@ A simple machine learning text-to-speech program powered by [kokoro](https://hug
Clone repo and go into the directory Clone repo and go into the directory
```bash ```bash
$ git clone https://git.ayo.run/ayo/simple-tts git clone https://git.ayo.run/ayo/simple-tts
$ cd simple-tts cd simple-tts
``` ```
Create new [Python virtual environment](https://realpython.com/python-virtual-environments-a-primer/). Here I use [`conda`](https://docs.conda.io/projects/conda/en/latest/user-guide/install/), but [venv](https://docs.python.org/3/library/venv.html) is also good. Create new [Python virtual environment](https://realpython.com/python-virtual-environments-a-primer/). Here I use [`conda`](https://docs.conda.io/projects/conda/en/latest/user-guide/install/), but [venv](https://docs.python.org/3/library/venv.html) is also good.
```bash ```bash
$ conda create -n tts conda create -n tts
### (optional) for Intel XPU specific device usage: ### (optional) for Intel XPU specific device usage:
$ conda create -n tts --clone llm-pt26 conda create -n tts --clone llm-pt26
``` ```
> [!Note] > [!Note]
@ -29,8 +29,8 @@ $ conda create -n tts --clone llm-pt26
Activate the environment and install the dependencies Activate the environment and install the dependencies
```bash ```bash
$ conda activate tts conda activate tts
$ python -m pip install -r requirements.txt python -m pip install -r requirements.txt
``` ```
### Required packages ### Required packages
@ -38,8 +38,8 @@ $ python -m pip install -r requirements.txt
The following are required packages aside from the python dependencies. `espeak-ng` is used by `kokoro` under the hood for english languages, and `libvlc` is used as the default audio player for the generated audio. The following are required packages aside from the python dependencies. `espeak-ng` is used by `kokoro` under the hood for english languages, and `libvlc` is used as the default audio player for the generated audio.
```bash ```bash
$ sudo apt update sudo apt update
$ sudo apt install vlc espeak-ng sudo apt install vlc espeak-ng
``` ```
> [!Note] > [!Note]
@ -50,7 +50,7 @@ $ sudo apt install vlc espeak-ng
For XPUs, we need to set some environmental variables. I have added a `env.sh` script which will activate the conda environment `tts` and set the environmental variables. For XPUs, we need to set some environmental variables. I have added a `env.sh` script which will activate the conda environment `tts` and set the environmental variables.
```bash ```bash
$ . env.sh . env.sh
``` ```
## Usage ## Usage
@ -58,20 +58,20 @@ $ . env.sh
Go into the directory and activate the environment: Go into the directory and activate the environment:
```bash ```bash
$ cd simple-tts cd simple-tts
$ conda activate tts conda activate tts
``` ```
If using Intel XPUs, set the env variables If using Intel XPUs, set the env variables
```bash ```bash
$ . env.sh . env.sh
``` ```
Running the program without arguments will use the demo text `tongue-twister.txt` with the default voice. Running the program without arguments will use the demo text `tongue-twister.txt` with the default voice.
```bash ```bash
$ python tts.py # will use default arguments python tts.py # will use default arguments
``` ```
### Providing text inputs ### Providing text inputs
@ -79,25 +79,25 @@ $ python tts.py # will use default arguments
You can pass a string as first argument: You can pass a string as first argument:
```bash ```bash
$ python tts.py "Hello world!" # will be read by the default voice python tts.py "Hello world!" # will be read by the default voice
``` ```
To run the program with an input file, use flag `--input_file`. To run the program with an input file, use flag `--input_file`.
```bash ```bash
$ python tts.py --input_file demo/tongue-twister.txt python tts.py --input_file demo/tongue-twister.txt
# or shorter... # or shorter...
$ python tts.py -i demo/tongue-twister.txt python tts.py -i demo/tongue-twister.txt
``` ```
You can also use the text stored in your clipboard (i.e., copied text). Select a text from anywhere (e.g., your web browser), copy it with `<ctrl>+C` or the context menu, then use the flag `--clipboard`: You can also use the text stored in your clipboard (i.e., copied text). Select a text from anywhere (e.g., your web browser), copy it with `<ctrl>+C` or the context menu, then use the flag `--clipboard`:
```bash ```bash
$ python tts.py --clipboard python tts.py --clipboard
# or shorter... # or shorter...
$ python tts.py -c python tts.py -c
``` ```
### Labeling your outputs ### Labeling your outputs
@ -106,10 +106,10 @@ You can indicate a title to be used as label (i.e., file name prefix and directo
```bash ```bash
# This will put the generated files in ./outputs/siple-greeting/ # This will put the generated files in ./outputs/siple-greeting/
$ python tts.py "Hello there!" --title "simple-greeting" python tts.py "Hello there!" --title "simple-greeting"
# or shorter # or shorter
$ python tts.py "Hello there!" -t "simple-greeting" python tts.py "Hello there!" -t "simple-greeting"
``` ```
### Voices ### Voices
@ -117,22 +117,22 @@ $ python tts.py "Hello there!" -t "simple-greeting"
Optionally, you can indicate a voice you want to use with the `--voice` flag. See [all voices available](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md). Optionally, you can indicate a voice you want to use with the `--voice` flag. See [all voices available](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md).
```bash ```bash
$ python tts.py --voice am_michael python tts.py --voice am_michael
# or shorter... # or shorter...
$ python tts.py -v am_michael python tts.py -v am_michael
``` ```
There are four shortcuts available to the best voices: `pro`, `hot`, `asmr`, `brit` (i.e., best trained voices), and `pro` is the default if no value is given There are four shortcuts available to the best voices: `pro`, `hot`, `asmr`, `brit` (i.e., best trained voices), and `pro` is the default if no value is given
```bash ```bash
$ python tts.py "Hello there!" --voice pro # af_heart python tts.py "Hello there!" --voice pro # af_heart
$ python tts.py "Hello there!" --voice hot # af_bella python tts.py "Hello there!" --voice hot # af_bella
$ python tts.py "Hello there!" --voice asmr # af_nicole python tts.py "Hello there!" --voice asmr # af_nicole
$ python tts.py "Hello there!" --voice brit # bf_emma python tts.py "Hello there!" --voice brit # bf_emma
``` ```
### Disable audio player ### Disable audio player
@ -140,10 +140,10 @@ $ python tts.py "Hello there!" --voice brit # bf_emma
You can disable the built-in audio player with `--skip_play` if you choose to play the audio files generated with your preferred player. You can disable the built-in audio player with `--skip_play` if you choose to play the audio files generated with your preferred player.
```bash ```bash
$ python tts.py "Hello there!" --voice asmr --skip_play python tts.py "Hello there!" --voice asmr --skip_play
# or shorter... # or shorter...
$ python tts.py "Hello there!" --voice asmr -s python tts.py "Hello there!" --voice asmr -s
``` ```
@ -152,15 +152,15 @@ $ python tts.py "Hello there!" --voice asmr -s
The `--verbose` flag can be used to show more informative messages. The `--verbose` flag can be used to show more informative messages.
```bash ```bash
$ python tts.py --verbose python tts.py --verbose
``` ```
The `--device` or `-d` flag can be used to set the desired device (i.e., processor) to use: The `--device` or `-d` flag can be used to set the desired device (i.e., processor) to use:
```bash ```bash
$ python tts.py --device cpu # will use the cpu python tts.py --device cpu # will use the cpu
$ python tts.py --device cuda # will use the NVIDIA GPU python tts.py --device cuda # will use the NVIDIA GPU
$ python tts.py --device xpu # will use the Intel GPU python tts.py --device xpu # will use the Intel GPU
``` ```
## Demo Outputs ## Demo Outputs