Skip to main content

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

Added support for Kokoro-82M. Just try this out:

str2speech --text "Hello again" --model "kokoro"

This is probably the easiest way to use the model.


Added support for Zyphra Zonos. Just 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 expects you to have Zonos installed on your system already. If you don't have it yet, 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 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:

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 .wav file name (optional, defaults to output.wav).
  • --model (-m): The TTS model to use (optional, defaults to suno/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")

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
  • Kokoro

Tested With These Dependencies

  • transformers==4.49.0
  • torch==2.5.1+cu124
  • numpy==1.26.4
  • scipy==1.13.1

License

This project is licensed under the GNU General Public License v3 (GPLv3).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

str2speech-0.2.2.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

str2speech-0.2.2-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file str2speech-0.2.2.tar.gz.

File metadata

  • Download URL: str2speech-0.2.2.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for str2speech-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0a7679da2d85e5a8744127880ba97bd833ea5606269217ce173c6da15bd53a98
MD5 79be298428a0abb2f7edf4d2bb07d541
BLAKE2b-256 5fb964224c9f7937765431619dd9daae42a26e7a1ab437ce1f8d1d31eb90989a

See more details on using hashes here.

File details

Details for the file str2speech-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: str2speech-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for str2speech-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 026bec852684610e6feb791d18f12ab6d3c685a2c577a5c1f213d1c4e2dd82c0
MD5 cd724ec7e6fbdf4ea87a03be258861f2
BLAKE2b-256 f8f4a2b6f2bf73af1205125ac83bba0e5acebfdcee819646cc1a8e7677c8d02d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page