Skip to main content

Wrapper for google cloud TTS.

Project description

Voicy

Wrapper for 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
  1. By first, you need to get API token in rucaptcha.
  2. After that import a Token object from voicy:
    from voicy import Token
  3. Then provide the API key to the get_token function:
    Token.get_token(rucaptcha_key="Token, that you got in the rucaptcha account.")
  4. If you do all alright you would get long string, that you should provide to Voice object in init.
Browser option
  1. By first, go to cloud.google.com/text-to-speech.
  2. After that scroll down to the demo part.
    Recaptcha
  3. Solve the captcha.
  4. After, open the developer console and go to the "Network" section. In the "Name" section search for proxy?url=https://texttospeech.googleapis.com ...
    The developer console
    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 Voice

voice = Voice(token="token")

print(
    voice.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


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.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

Voicy-0.1.2-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page