A powerful, Transformer-based text-to-speech (TTS) tool.
Project description
👉 str2speech 👈 🦾🔊
Overview
str2speech is a simple command-line tool for converting text to speech using Transformer-based text-to-speech (TTS) models. It supports multiple models and voice presets, allowing users to generate high-quality speech audio from text.
Latest
We now support Spark-TTS-0.5B. This is an awesome model. Here's how you use it:
str2speech --model "SparkAudio/Spark-TTS-0.5B" \
--text "Hello from Spark" \
--output "sparktest.wav"
Added support for Sesame CSM-1B. Here's how to use it:
export HF_TOKEN=<your huggingface token>
str2speech --text "Hello from Sesame" --model "sesame/csm-1b"
Added support for Kokoro-82M. This is how you run it:
str2speech --text "Hello again" --model "kokoro"
This is probably the easiest way to use Kokoro TTS.
Added support for Zyphra Zonos. Try this out:
str2speech --text "Hello again" \
--model "Zyphra/Zonos-v0.1-transformer" \
--output helloagain.wav
Alternatively, you could write Python code to use it:
from str2speech.speaker import Speaker
speaker = Speaker("Zyphra/Zonos-v0.1-transformer")
speaker.text_to_speech("Hello, this is a test!", "output.wav")
str2speech will try to install Zonos if it doesn't detect it
on your system. You might still have to install espeak-ng manually.
If you choose to install Zonos yourself, please run the following:
apt install espeak-ng
git clone https://github.com/hathibelagal-dev/Zonos.git
cd Zonos && pip install -e .
Features
- Supports multiple TTS models, including
suno/bark-small,suno/bark, and variousfacebook/mms-ttsmodels. - Allows selection of voice presets.
- Supports text input via command-line arguments or files.
- Outputs speech in
.wavformat. - Works with both CPU and GPU.
Available Models
The following models are supported:
Sesame/CSM-1BSparkAudio/Spark-TTS-0.5BZyphra/Zonos-v0.1-transformerKokorosuno/bark-small(default)suno/barkfacebook/mms-tts-engfacebook/mms-tts-deufacebook/mms-tts-frafacebook/mms-tts-spa
Installation
To install str2speech, first make sure you have pip installed, then run:
pip install str2speech
Usage
Command Line
Run the script via the command line:
str2speech --text "Hello, world!" --output hello.wav
Options
--text(-t): The text to convert to speech.--file(-f): A file containing text to convert to speech.--voice(-v): The voice preset to use (optional, defaults to a predefined voice).--output(-o): The output.wavfile name (optional, defaults tooutput.wav).--model(-m): The TTS model to use (optional, defaults tosuno/bark-small).
Example:
str2speech --file input.txt --output speech.wav --model suno/bark
API Usage
You can also use str2speech as a Python module:
from str2speech.speaker import Speaker
speaker = Speaker()
speaker.text_to_speech("Hello, this is a test.", "test.wav")
Tested With These Dependencies
transformers==4.49.0torch==2.5.1+cu124numpy==1.26.4scipy==1.13.1
License
This project is licensed under the GNU General Public License v3 (GPLv3).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file str2speech-0.3.0.tar.gz.
File metadata
- Download URL: str2speech-0.3.0.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
623d821efef7ac844fff178b95fc05e4a6d30cc5c20ee786d36a6c8c170427cf
|
|
| MD5 |
ae83ad7bc22dbce7e81873fa793b7bbb
|
|
| BLAKE2b-256 |
2181f2cc6b4c3973ae90cbc6cd4cd18ae4696c314b6a433a64db3eb983d23ed3
|
File details
Details for the file str2speech-0.3.0-py3-none-any.whl.
File metadata
- Download URL: str2speech-0.3.0-py3-none-any.whl
- Upload date:
- Size: 27.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d986f26920e3e81c83886788aec1dd89c9c682951d602cc4f367a53610585e6d
|
|
| MD5 |
ed7cc23bba17adfb77ac061041b822d3
|
|
| BLAKE2b-256 |
67f35b8a031b23ff7cd89d11b334fded01595dff23439c794e05e1d4dfd891e1
|