Use Google's Cloud Text-to-Speech (TTS) API to generate audio files from a text document with Python.
- Clone this repository
git clone https://github.com/ArcaneSolutionsLLC/google-tts.git
- Create a virtual environment
python -m venv venv
- Install the required packages
pip install -r requirements.txt
- Create a Google Cloud Text-to-Speech app
- Create a Google API Service Account
- Download the service account JSON key to the project directory
- Add your text to the text.txt file
- Run the app
python app.py
- Listen to the generated audio file output.mp3
Alternatively you can use the provided run.sh file to do the following in a single command:
- Overwrite text.txt file with your clipboard contents
- Run app.py to convert the text to audio
- Stream the audio
The run.sh script requires that xsel and vlc are installed.