Metadata-Version: 2.1
Name: google-text-to-speech
Version: 0.1.21
Summary: A text-to-speech conversion tool using Google Translate API
Home-page: https://gitlab.com/labsoft-ai/google-translate-tts
Author: Momcilo Krunic
Author-email: momcilo.krunic@labsoft.ai
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE

![img](images/google_translate.png)

# Google Translate TTS

The `google_text_to_speech` package is a Python-based solution designed to provide versatile and user-friendly text-to-speech (TTS) capabilities. Leveraging the Google Translate TTS API, it enables users to convert written text into spoken words in various languages, catering to a wide range of applications.

[Documentation](https://labsoft-ai.gitlab.io/google-translate-tts)

[PyPI](https://pypi.org/project/google-text-to-speech)

[GitLab](https://gitlab.com/labsoft-ai/google-translate-tts)

### Hello World! Example

This example demonstrates how to use the `google_text_to_speech` package to convert a simple text string, "Hello World!", into speech.

#### Prerequisites

Ensure that you have installed the `google_text_to_speech` package:

```bash
pip install google_text_to_speech
```

```
from google_text_to_speech import play_tts

# Text to be converted to speech
text = "Hello World!"
language = "en"  # Language code (e.g., "en" for English)

# Calling the text-to-speech function
play_tts(text, language)

```

## Directory tree structure

```
.
├── docs
│   ├── conf.py
│   ├── index.rst
│   ├── make.bat
│   ├── Makefile
│   ├── prepare_plantuml.sh
│   ├── requirements.txt
│   └── src
│       ├── architecture.md
│       └── user_stories.md
├── images
│   └── google_translate.png
├── LICENSE
├── README.md
├── requirements.txt
├── setup.py
├── src
│   └── google_text_to_speech
│       ├── google_translate_tts.py
│       ├── __init__.py
│       └── _version.py
└── tests
    └── test_google_translate_tts.py

6 directories, 17 files
```

## Key Features

* **Multiple Language Support:** Utilizes Google's TTS service to offer speech synthesis in numerous languages.
* **Handling of Large Texts:** Splits long texts into sentences to avoid limitations related to URL length and TTS service constraints.
* **Real-Time Audio Playback:** Converts text to speech in real-time, with the capability to play the audio immediately.
* **Concurrency and Resource Management:** Implements threading to manage audio playback and file operations simultaneously, ensuring smooth performance d optimal resource usage.

## Technologies

* **Python:** The module is written in Python, making it versatile and easy to integrate into various applications.
* **External Libraries:** Uses `requests` for API calls and `playsound` for audio playback, along with standard libraries like `re` for text processing.
* **Google Translate TTS API:** Leverages this API for reliable and high-quality text-to-speech conversion.

## Potential Use Cases

* **Language Learning Tools:** Assists in pronunciation and language learning by providing auditory examples.
* **Accessibility Tools:** Helps in creating applications that can read out content to users with visual impairments.
* **Content Consumption:** Enables users to listen to articles, books, or any text content, enhancing the experience of consuming written material.


