Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
/ asyncgTTS Public archive

Async interfaces to the official Google Text to Speech or easygtts APIs

License

Notifications You must be signed in to change notification settings

GnomedDev/asyncgTTS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asyncgTTS

Asynchronous interfaces to the official Google Text to Speech or easygTTS APIs written with aiohttp.

Examples

asyncgTTS

import asyncio
from subprocess import PIPE, run

import aiohttp
import asyncgTTS

async def main():
    async with aiohttp.ClientSession() as session:
        gtts = await asyncgTTS.setup(premium=True, session=session, service_account_json_location="SERVICE_ACCOUNT.json")

        hello_world_ogg = await gtts.get("Hello World", voice_lang=("en-US-Standard-B", "en-us"))
        hello_world_mp3 = await gtts.get("Hello World", voice_lang=("en-US-Standard-A", "en-us"), ret_type="MP3")

    with open("Hello_world.ogg", "wb") as f:
        f.write(hello_world_ogg)
    with open("Hello_world.mp3", "wb") as f:
        f.write(hello_world_mp3)

asyncio.run(main())

easygTTS

import asyncio

import aiohttp
import asyncgTTS

async def main():
    async with aiohttp.ClientSession() as session:
        gtts = await asyncgTTS.setup(premium=False, session=session)
        hello_world = await gtts.get(text="Hello World")

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

asyncio.run(main())

About

Async interfaces to the official Google Text to Speech or easygtts APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages