A tool for requesting text to speech from a variety of cloud APIs.
Project description
Cloud TTS
This package is in development but will allow you to easily connect to a variety of text to speach apis.
Please set keyring items:
Google Cloud: https://cloud.google.com/iam/docs/service-accounts-create
#python console
import keyring
keyring.set_password("google_tts", "google_private_key_id", "<GOOGLE_PRIVATE_KEY_ID_FROM_JSON>")
keyring.set_password("google_tts", "google_private_key", "<GOOGLE_PRIVATE_KEY_FROM_JSON>")
keyring.set_password("google_tts", "google_client_email", "<GOOGLE_CLIENT_EMAIL>")
The other items don't appear to matter.
#AWS Polly: in console, IAM, Users, Add user, choose a username Attatch Policies Directly select only "AmazonPollyReadOnlyAccess" Create User, copy Access key ID and Secret access key and add them to your keychain
#python console
import keyring
keyring.set_password("aws_tts", "aws_access_key_id", "<AWS_ACCESS_KEY_ID>")
keyring.set_password("aws_tts", "aws_secret_access_key", "<AWS_SECRET_ACCESS_KEY>")`
#Microsoft Azure: https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=script%2Cwindowsinstall&pivots=programming-language-python Create Speech Services resource Pay-as-you-go/DefaultResourceGroup-CUS Choose region Name resource (don't use spaces or underscores) Chose pricing tier (free allows for about an hour of neural voice per month) Network type: Selected Network create new virtual network and subnet put your ip address in the firewall (https://www.google.com/search?q=what+is+my+ip) Review and Create Create
From home you should see the name of your resource, click on it Click Manage Keys Copy Key 1 and add it to your keychain Copy Location/Region and add it to your keychain (not really a secret, but since your key is tied to a region, it's nice to have it in the same place)
#python console
import keyring
keyring.set_password("azure_tts", "azure_key", "<AZURE_KEY_1>")
keyring.set_password("azure_tts", "azure_region", "<AZURE_REGION>")
Usage
import keyring
from cloud_tts import get_voices
platform = "google" # or "aws" or "azure"
voice_list = get_voices(platform)
# print out the voices
for voice in voice_list:
print(f'{voice["id"]} {voice["name"]} {voice["language"]}')
Send text to cloud
from cloud_tts import make_tts, example_text
audio_content = make_tts(text =example_text(), voice="en-US-Wavenet-A", platform="google", loc="en_US", gender="FEMALE")
#save audio
filename = "example.mp3"
with open("example.mp3", "wb") as f:
f.write(audio_content)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloud_tts_tool-0.0.75.tar.gz.
File metadata
- Download URL: cloud_tts_tool-0.0.75.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13330d9ae0ef6c4eb8dba8ac79ab42f415f3408e99eb0252a6f890db835cf977
|
|
| MD5 |
8d950b3ca80fede323dcac49a9bb2f0f
|
|
| BLAKE2b-256 |
16a022f585859a8353fcc5ff18578611e4719f0e1c2672f0d26b8fc68849112d
|
File details
Details for the file cloud_tts_tool-0.0.75-py3-none-any.whl.
File metadata
- Download URL: cloud_tts_tool-0.0.75-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96be26642cb4b4252ebe0e13293cb922bcd9674432f5aa960bb12c0621c4894f
|
|
| MD5 |
e4a54ee977110e34d2d5582a56a91384
|
|
| BLAKE2b-256 |
35451cea8fdf839fe1cc6c74767b8f6512785f530d95e04060cac6f227b869ce
|