add pronon

This commit is contained in:
ruslangilfanov 2025-06-15 22:53:16 +03:00
parent 884c68314a
commit 709adbf507
No known key found for this signature in database
2 changed files with 19 additions and 0 deletions

View File

View File

@ -0,0 +1,19 @@
from __future__ import annotations
import io
from aiogtts import aiogTTS
from ..languages import LanguageEnum
async def get_pronunciation(text: str, source_lang: LanguageEnum) -> io.BytesIO:
aiogtts = aiogTTS()
buffer = io.BytesIO()
await aiogtts.write_to_fp(
text=text,
fp=buffer,
slow=True,
lang=source_lang.value,
)
return buffer