From 1d2de84900413fff6a7a4ffc532a031acb9d7db6 Mon Sep 17 00:00:00 2001 From: Antonio Andrade Date: Tue, 8 Feb 2022 10:26:52 +0400 Subject: [PATCH] Added "TTS - Text to Speech Mp3" (#248) * New commit * Added example file (run.py) * New commit * Added 'TTS - Text to Speech Mp3' --- README.md | 1 + TTS_Text_to_Speech_Mp3/README.md | 20 ++++++++++++++++++++ TTS_Text_to_Speech_Mp3/requirements.txt | 1 + TTS_Text_to_Speech_Mp3/run.py | 8 ++++++++ 4 files changed, 30 insertions(+) create mode 100644 TTS_Text_to_Speech_Mp3/README.md create mode 100644 TTS_Text_to_Speech_Mp3/requirements.txt create mode 100644 TTS_Text_to_Speech_Mp3/run.py diff --git a/README.md b/README.md index 7983725..39e8ed8 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ So far, the following projects have been integrated to this repo: |[SMS your location](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/SmsYourLocation)|[prince]()| |[Squid installer for Ubuntu](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Squid-Proxy-Installer-for-Ubuntu16)|[Berkay Demir]()| |[Subtitle downloader](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Subtitle-downloader)|[Kaushlendra Pratap](https://github.com/kaushl1998)| +|[TTS - Text to Speech Mp3](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/TTS_Text_to_Speech_Mp3)|[Antonio Andrade](https://github.com/xAndrade)| |[Top_News](Top_News)|[Attupatil](https://github.com/Attupatil)| |[Take Screenshot](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Take_screenshot)|[Moad Mohammed Elhebri](https://github.com/moadmmh)| |[To Do Bot](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/To-Do-Bot) | [Darshan Patel](https://github.com/DarshanPatel11)| diff --git a/TTS_Text_to_Speech_Mp3/README.md b/TTS_Text_to_Speech_Mp3/README.md new file mode 100644 index 0000000..2090b69 --- /dev/null +++ b/TTS_Text_to_Speech_Mp3/README.md @@ -0,0 +1,20 @@ +# TTS - Text to Speech Mp3 + +Write spoken mp3 data to a file, a file-like object (bytestring) for further audio manipulation, or stdout. +This example uses the Python library [gTTS](https://pypi.org/project/gTTS/) (Google Text-to-Speech), to interface with Google Translate's text-to-speech API. + +## Installation + +``$ pip install requirements.txt`` + +## Quickstart + +``` +>>> from gtts import gTTS +>>> tts = gTTS('hello') +>>> tts.save('hello.mp3') +``` + +## Disclaimer + +[gTTS](https://pypi.org/project/gTTS/) project is not affiliated with Google or Google Cloud. Breaking upstream changes can occur without notice. This project is leveraging the undocumented Google Translate speech functionality and is different from Google Cloud Text-to-Speech. diff --git a/TTS_Text_to_Speech_Mp3/requirements.txt b/TTS_Text_to_Speech_Mp3/requirements.txt new file mode 100644 index 0000000..458b2d6 --- /dev/null +++ b/TTS_Text_to_Speech_Mp3/requirements.txt @@ -0,0 +1 @@ +gTTS diff --git a/TTS_Text_to_Speech_Mp3/run.py b/TTS_Text_to_Speech_Mp3/run.py new file mode 100644 index 0000000..715dcf7 --- /dev/null +++ b/TTS_Text_to_Speech_Mp3/run.py @@ -0,0 +1,8 @@ +from gtts import gTTS + +def main(): + tts = gTTS('hello') + tts.save('hello.mp3') + +if __name__ == "__main__": + main()