Skip to main content

Text-to-Speech

PyPi Version MIT License

A versatile and user-friendly Python Text-to-Speech engine with customizable options.

Table of Contents

Installation

You can install the text-to-speech module using pip:

pip install text-to-speech

Usage

Basic Usage

You can use this module to convert text to speech and save it as an audio file. Here's a basic example:

from text_to_speech import save

text = "Hello, World!"
language = "en"  # Specify the language (IETF language tag)
output_file = "hello_world.mp3"  # Specify the output file (only accepts .mp3)

save(text, language, file=output_file)

Parameters

Here are the available parameters for the save function:

Parameter Description Default Value
text The text to be converted to speech.
language The language (IETF language tag) to use for speech synthesis. "en"
slow Set to True if you want the text to be read more slowly. False
file The name of the output audio file. Only accepts .mp3 format. "speech.mp3"
lang_check Set to True to check the text for language errors. False

Example with Slow Speech

You can make the speech slower by setting the slow parameter to True:

from text_to_speech import save

text = "This is a slow speech example."
language = "en"
output_file = "slow_speech.mp3"

save(text, language, slow=True, file=output_file)

Contributing

Contributions to this project are welcome. If you have any improvements or bug fixes, please submit a pull request.

License

This project is licensed under the MIT License.

Metadata

Release files for text-to-speech 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for text-to-speech 1.6.1
File Size Uploaded
text_to_speech-1.6.1.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for text-to-speech 1.6.1
File Interpreter ABI Platform
text_to_speech-1.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / text_to_speech-1.6.1.tar.gz

Download URL text_to_speech-1.6.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d639d79669211774de23e364d6fce22b19ff080e2b376a8fdc47765d0e32ea47
BLAKE2b-256 checksum
How to use checksums
d7f0230f3f0ab7e4e5eee130ecdd2271719b574568e92a65ec6d6b6a45a626ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / text_to_speech-1.6.1-py3-none-any.whl

Download URL text_to_speech-1.6.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b84b392697c3aa6fb188427db051b29016cbafc0fa4e1a79f73c97038132a53
BLAKE2b-256 checksum
How to use checksums
2ca071e501c180d875897e15ecc5e95f4accbc64fb12591d9e8f542684ce02bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.6.1 This release

2 release files

1.6.0

2 release files

1.5.3

1 release file

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.1

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page