Skip to main content

A tool/library to quickly turn text to speech.

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.

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

Dependencies

  • transformers
  • torch
  • scipy

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.1.3.tar.gz (16.3 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.1.3-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for str2speech-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7e6c50445e5d397d52b5fdc8a4578593600aa2619f65e550d9d9c458eeec182b
MD5 575e0e739232e00535f4d23a6ac92dc6
BLAKE2b-256 1f5315cd52848ab55419c63f22189a51079838bd195ddcacbc697ea61940c978

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for str2speech-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 895b65accd34329d0073638a9e469d92ec9cca7160d56ae6512f4b808170087c
MD5 914b16645036381a5c4189e463a61f59
BLAKE2b-256 9ce7d748b725c34e70405ad5c3f2725891d900e45e5228b23ec84ab7e9fb7a40

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