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 facebook/mms-tts-eng.
  • Allows selection of voice presets.
  • 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:

python -m str2speech.main --text "Hello, world!" --output hello.wav

Options

  • --text (-t): The text to convert to speech (required).
  • --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:

python -m str2speech.main -t "This is an AI-generated voice." -o speech.wav -m 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
  • facebook/mms-tts-hin

Dependencies

  • transformers
  • torch
  • scipy

License

This project is licensed under the GNU General Public License V3.

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.2.tar.gz (16.0 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.2-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: str2speech-0.1.2.tar.gz
  • Upload date:
  • Size: 16.0 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.2.tar.gz
Algorithm Hash digest
SHA256 cb7cd3774003bda2e4d96d3e83024e1a87b9c6231b18204bd63dd5b365ad69ff
MD5 cdf4baeee6507c76038ff2ca16cc1194
BLAKE2b-256 cc7d1b88a96c20cd9a86a44fd1b0a1e67e978644c90dea07d99df1d68659eb44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: str2speech-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 57d4a1b641f6dc1cc5bb94a7edbc887998e3a988011163f16cae0d7ddbff29a4
MD5 7e30760fc9010bce3dfecebabb86c686
BLAKE2b-256 eeac043b979eb36bc2f2da2d11808cc1d3d0d67e129042e518300056b01ca6b7

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