Skip to main content

Simple text-to-speech converter with multiple languages and voices

Project description

Text-to-Speech (TTS) Simple (by HMCorp)

This repository provides a simple implementation of a Text-to-Speech (TTS) system. It allows users to generate speech audio files (MP3 or WAV) from text files. The project is designed to be lightweight and easy to use.

Features

  • Convert text files into MP3 or WAV audio files
  • Support for multiple languages (over 50 languages supported)
  • Various voice accents for certain languages
  • Cross-platform support for macOS, Windows, and Linux
  • Easy setup and usage

Requirements

  • Python 3.8 or higher
  • pip (Python package manager)
  • FFmpeg (only for WAV file conversion)

Installation

Using pip

  1. Install Python (if not already installed):

    • On macOS:
      brew install python
      
    • On Windows: Download and install Python from python.org. Ensure you check the box to add Python to your PATH during installation.
  2. Install the package:

    pip install tts-simple
    

    This will automatically install all required Python dependencies.

  3. Install FFmpeg for WAV file generation (optional):

    • On macOS:
      brew install ffmpeg
      
    • On Windows: Download and install FFmpeg from FFmpeg.org. Add the FFmpeg binary to your system PATH.

Usage

Command Line Interface

Convert a text file to speech with default settings (English, MP3):

tts-simple input.txt

Specify output file:

tts-simple input.txt output

Convert to WAV format:

tts-simple input.txt -f wav

Use a different language:

tts-simple input.txt -l es  # Spanish

Change voice accent:

tts-simple input.txt -t co.uk  # British English

Use slower speech:

tts-simple input.txt -s

List all available languages and voices:

tts-simple --list

Python API

You can also use the library in your Python code:

from tts_simple import text_to_speech

# Generate speech in English (default)
text_to_speech("input.txt", "output", language="en", output_format="mp3")

# Generate speech in Spanish with slower speed
text_to_speech("input.txt", "output_spanish", language="es", speed=True)

# Generate speech with British accent 
text_to_speech("input.txt", "output_british", tld="co.uk")

Dependencies

The package automatically installs all required Python dependencies, which include:

  • gTTS (Google Text-to-Speech)
  • FFmpeg (is required only if you want to generate WAV files).

Notes

  • The default output format is MP3
  • If no output file is specified, the input filename (with appropriate audio extension) will be used
  • TLD options (voice accents) work best with English language

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

Contact

For questions or support, please contact [apavlenko@hmcorp.fund].

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

tts_simple-0.1.2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

tts_simple-0.1.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tts_simple-0.1.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tts_simple-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2284869f4f13c91b498d8febda8ce3e1a4c139f1dabe11dbf73a698bbf668fa7
MD5 93235eb55de859ac7e65cd2da1e7cb0b
BLAKE2b-256 2714261b384b6028b06299bc9625c62591bc76a3ecb1497101394a5e77aefd4d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tts_simple-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tts_simple-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4b4d6fa6f4cbafc3a5101974fb880912cc3e9ebe389b9a52c86a0cf4495e25
MD5 30064f4ea05dab3f778a72e126506375
BLAKE2b-256 1fa049c89928669cbe7727681a5ac1679fea263c478c8f9333f6d893fcbbe09b

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