Wrapper for google cloud TTS.
Project description
Voicy
Wrapper for free use Google cloud TTS.
Installation:
Download library using pip
$ pip3 install voicy
Getting the token:
For a request to the client need to provide a token. You can easily get it using Token object, or in a browser by yourself.
Both options are described below:
Automated option
- By first, you need to get API token in rucaptcha.
-
After that import a Token object from voicy:
from voicy import Token
-
Then provide the API key to the get_token function:
Token.get_token(rucaptcha_key="Token, that you got in the rucaptcha account.")
- If you do all alright you would get long string, that you should provide to Voice object in init.
Browser option
- By first, go to cloud.google.com/text-to-speech.
-
After that scroll down to the demo part.
- Solve the captcha.
-
After, open the developer console and go to the "Network" section. In the "Name"
section search for proxy?url=https://texttospeech.googleapis.com ...
Scroll to the "Query string parameters". And here is your token.
Usage example:
For using TTS you need to provide a voice setting. In Voicy you need to provide a dictionary, with a key, that is your
language code and voice model. Format to both you can find in
docs. Example {"en-US": "en-US-Wavenet-A"}
.
from voicy import Voicy
voicy = Voicy(token="token")
print(
voicy.tts(
text="You are using a Voicy library. Please, give a star, if you like it.",
voice={"en-US": "en-US-Wavenet-A"},
)
)
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
voicy-0.1.2.1.tar.gz
(5.0 kB
view hashes)