# 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
Added support for Zyphra Zonos. Just try this out:
```
from str2speech.speaker import Speaker
speaker = Speaker("Zyphra/Zonos-v0.1-transformer")
speaker.text_to_speech("Hello, this is a test!", "output.wav")
```
This expects you to have Zonos installed. If you don't have it yet, run the following:
```
!apt install espeak-ng
!git clone https://github.com/Zyphra/Zonos.git
!cd Zonos && pip install -e .
```
## Features
- Supports multiple TTS models, including `suno/bark-small`, `suno/bark`, and various `facebook/mms-tts` models.
- Allows selection of voice presets.
- Supports text input via command-line arguments or files.
- Outputs speech in `.wav` format.
- Works with both CPU and GPU.
## Installation
To install `str2speech`, first make sure you have `pip` installed, then run:
```sh
pip install str2speech
```
## Usage
### Command Line
Run the script via the command line:
```sh
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 `.wav` file name (optional, defaults to `output.wav`).
- `--model` (`-m`): The TTS model to use (optional, defaults to `suno/bark-small`).
Example:
```sh
str2speech --file input.txt --output speech.wav --model suno/bark
```
## API Usage
You can also use `str2speech` as a Python module:
```python
from str2speech.speaker import Speaker
speaker = Speaker()
speaker.text_to_speech("Hello, this is a test.", "test.wav")
```
## Available Models
The following models are supported:
- `suno/bark-small` (default)
- `suno/bark`
- `facebook/mms-tts-eng`
- `facebook/mms-tts-deu`
- `facebook/mms-tts-fra`
- `facebook/mms-tts-spa`
- `Zyphra/Zonos-v0.1-transformer`
## Tested With These Dependencies
- `transformers==4.49.0`
- `torch==2.5.1+cu124`
- `numpy==2.2.3`
- `scipy==1.13.1`
## License
This project is licensed under the GNU General Public License v3 (GPLv3).
Raw data
{
"_id": null,
"home_page": "https://github.com/hathibelagal-dev/str2speech",
"name": "str2speech",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "ai text-to-speech speech-synthesis nlp transformer voice",
"author": "Ashraff Hathibelagal",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/cd/17/a6e658c9ce78c3d59c6f0b1d56abb80a6d58ccbbffb0484948d69e94d2fa/str2speech-0.1.4.tar.gz",
"platform": null,
"description": "# str2speech\n\n## Overview\n`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.\n\n## Latest\n\nAdded support for Zyphra Zonos. Just try this out:\n\n```\nfrom str2speech.speaker import Speaker\n\nspeaker = Speaker(\"Zyphra/Zonos-v0.1-transformer\")\nspeaker.text_to_speech(\"Hello, this is a test!\", \"output.wav\")\n```\n\nThis expects you to have Zonos installed. If you don't have it yet, run the following:\n```\n!apt install espeak-ng\n!git clone https://github.com/Zyphra/Zonos.git\n!cd Zonos && pip install -e .\n```\n\n## Features\n- Supports multiple TTS models, including `suno/bark-small`, `suno/bark`, and various `facebook/mms-tts` models.\n- Allows selection of voice presets.\n- Supports text input via command-line arguments or files.\n- Outputs speech in `.wav` format.\n- Works with both CPU and GPU.\n\n## Installation\n\nTo install `str2speech`, first make sure you have `pip` installed, then run:\n\n```sh\npip install str2speech\n```\n\n## Usage\n\n### Command Line\nRun the script via the command line:\n\n```sh\nstr2speech --text \"Hello, world!\" --output hello.wav\n```\n\n### Options\n- `--text` (`-t`): The text to convert to speech.\n- `--file` (`-f`): A file containing text to convert to speech.\n- `--voice` (`-v`): The voice preset to use (optional, defaults to a predefined voice).\n- `--output` (`-o`): The output `.wav` file name (optional, defaults to `output.wav`).\n- `--model` (`-m`): The TTS model to use (optional, defaults to `suno/bark-small`).\n\nExample:\n```sh\nstr2speech --file input.txt --output speech.wav --model suno/bark\n```\n\n## API Usage\n\nYou can also use `str2speech` as a Python module:\n\n```python\nfrom str2speech.speaker import Speaker\n\nspeaker = Speaker()\nspeaker.text_to_speech(\"Hello, this is a test.\", \"test.wav\")\n```\n\n## Available Models\n\nThe following models are supported:\n- `suno/bark-small` (default)\n- `suno/bark`\n- `facebook/mms-tts-eng`\n- `facebook/mms-tts-deu`\n- `facebook/mms-tts-fra`\n- `facebook/mms-tts-spa`\n- `Zyphra/Zonos-v0.1-transformer`\n\n## Tested With These Dependencies\n- `transformers==4.49.0`\n- `torch==2.5.1+cu124`\n- `numpy==2.2.3`\n- `scipy==1.13.1`\n\n## License\nThis project is licensed under the GNU General Public License v3 (GPLv3).\n",
"bugtrack_url": null,
"license": null,
"summary": "A powerful, Transformer-based text-to-speech (TTS) tool.",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/hathibelagal-dev/str2speech",
"Source": "https://github.com/hathibelagal-dev/str2speech",
"Tracker": "https://github.com/hathibelagal-dev/str2speech/issues"
},
"split_keywords": [
"ai",
"text-to-speech",
"speech-synthesis",
"nlp",
"transformer",
"voice"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9dc50c116f3673ba3aca6da63d327501ecd62d0eee6b47f2d5314e5954cd1c78",
"md5": "b6d7f1bbee94afd847bcb4885b8051e6",
"sha256": "afc9dd1c5a882fe30fe186c89db8db39c6b94d813defb7d1f6838e754b6f7c6d"
},
"downloads": -1,
"filename": "str2speech-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b6d7f1bbee94afd847bcb4885b8051e6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 17317,
"upload_time": "2025-02-27T00:09:27",
"upload_time_iso_8601": "2025-02-27T00:09:27.070230Z",
"url": "https://files.pythonhosted.org/packages/9d/c5/0c116f3673ba3aca6da63d327501ecd62d0eee6b47f2d5314e5954cd1c78/str2speech-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cd17a6e658c9ce78c3d59c6f0b1d56abb80a6d58ccbbffb0484948d69e94d2fa",
"md5": "e0117233ba94dab7e2d2edf591a4a4f3",
"sha256": "35e531b2c014faff0f1df077a44c2ac1c3925d60c55a42c907331d95f1a664bc"
},
"downloads": -1,
"filename": "str2speech-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "e0117233ba94dab7e2d2edf591a4a4f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 16754,
"upload_time": "2025-02-27T00:09:28",
"upload_time_iso_8601": "2025-02-27T00:09:28.944952Z",
"url": "https://files.pythonhosted.org/packages/cd/17/a6e658c9ce78c3d59c6f0b1d56abb80a6d58ccbbffb0484948d69e94d2fa/str2speech-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-27 00:09:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hathibelagal-dev",
"github_project": "str2speech",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "str2speech"
}