Skip to main content

Voicy

Wrapper for free use TTS & STT services.

Installation:

Download library using pip
$ pip3 install voicy -U

Usage example:

Google Cloud

For a request to the Google Cloud client, you need to provide a token. You can easily get it using GoogleToken object, or in a browser by yourself.

Both options are described below:

Automated option
  1. By first, you need to get API key in rucaptcha.
  2. After that import a GoogleToken object from voicy:
    from voicy import GoogleToken
  3. Then provide the API key to the get_token function:
    GoogleToken.get_token(rucaptcha_key="Key, that you got in the rucaptcha account.")
  4. If you do all alright you would get long string, that you should provide to Google 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 column "Name" search for proxy?url=https://texttospeech.googleapis.com ...
    The developer console
    Scroll to the "Query string parameters". That long string is your token. Provide it to Google object in init.

For using TTS you need to provide a dictionary where the key is your language code and the value is your voice model. Format to both you can find in docs. Also, if you don't want to get a token you can use a TTS from Google Translate.

Simple TTS example:
from voicy import Google

google = Google(token="token")

print(
    google.tts(
        text="You are using a Voicy library. Please, give a star, if you like it.",
        voice={"en-US": "en-US-Wavenet-A"},
    )
)
This example will return File(path="84PFetz5IJdT4Je.wav", format="wav")

Simple STT example:

For using STT you only need to provide a language code. Format for it you can find in docs.

from voicy import Google

google = Google(token="token")

print(
    google.stt(
        file="84PFetz5IJdT4Je.wav",
        language_code="en-US",
    )
)
This example will return Transcript(text="You are using a Voicy library. Please, give a star, if you like it.", confidence=0.93750596, path="84PFetz5IJdT4Je.wav", format="wav")

Yandex Cloud:

For using Yandex TTS you don't need to provide any token. Just pass text, language code and voice model:

from voicy import Yandex

yandex = Yandex()

print(
    yandex.tts(
        text="You are using a Voicy library. Please, give a star, if you like it.",
        language_code="en-US",
        voice="ermil",
    )
)
This example will return File(path="SUypGpSLTvGKTTy.wav", format="wav")

License

The library is under the GNU LGPLv3 license.

BE AWARE THAT THE AUTHORS ARE UNDER NO CIRCUMSTANCES RESPONSIBLE FOR CONSEQUENCES OF USE AND ANY INTERACTION WITH THE LIBRARY. NOT LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE CODE IS PROVIDED FOR EDUCATION PURPOSES ONLY.

Read the LICENSE for more information.

Contributing

Feel free to contribute.

Release files for voicy 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for voicy 0.4.2
File Size Uploaded
voicy-0.4.2.tar.gz 11.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for voicy 0.4.2
File Interpreter ABI Platform
voicy-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / voicy-0.4.2.tar.gz

Download URL voicy-0.4.2.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e9884be5018d907284e8460228f836cf382ced1c387453884ea4f2736c48936a
BLAKE2b-256 checksum
How to use checksums
858b4bce0a85231c9d86b7cf6e4ddab5db30b252a08f729d592077bf7aa7a7fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release files / voicy-0.4.2-py3-none-any.whl

Download URL voicy-0.4.2-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1aae214924232b82c53c6971a255eebd7fad10cafb300a6592d1edcdff14d9e9
BLAKE2b-256 checksum
How to use checksums
6c3656fc892b3147cbecc922286c07edef07c07f089695bf734b9124fc57fa68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.16

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page