1
0
Fork 0
mirror of synced 2026-12-06 18:52:25 +00:00
No description
Find a file
2021-06-15 10:17:55 -04:00
.github Create python-publish.yml 2021-06-05 10:32:40 -04:00
asyncgTTS Simplify 2021-06-15 10:17:55 -04:00
.gitignore .gitignore 2021-06-01 15:34:41 -04:00
LICENCE Fix up & remove easy-gtts-api 2021-06-01 17:01:34 -04:00
pyproject.toml Fix up & remove easy-gtts-api 2021-06-01 17:01:34 -04:00
README.md Simplify 2021-06-15 10:17:55 -04:00
setup.cfg Update setup.cfg 2021-06-03 09:11:48 -04:00

asyncgTTS

Asynchronous interfaces to the official Google Text to Speech API written with aiohttp.

Similar to googleapis/python-texttospeech in concept, but asyncgTTS was designed with asynchronously in mind and is expected to be more performant.

Example

import asyncio
import json

from asyncgTTS import AsyncGTTSSession, ServiceAccount


async def main():
    with open("SERVICE_ACCOUNT.JSON") as service_account_json:
        service_account_dict = json.load(service_account_json)
        
    service_account = ServiceAccount.from_service_account_dict(service_account_dict)
    
    async with AsyncGTTSSession.from_service_account(service_account) as google_tts:
        audio_bytes = await google_tts.synthesize("vine boom")

    with open("Hello_world.mp3", "wb") as f:
        f.write(audio_bytes)


asyncio.run(main())