Async update.
This commit is contained in:
parent
54a4ae12f4
commit
f28084750f
@ -40,6 +40,9 @@ import google.oauth2.credentials
|
||||
import uuid
|
||||
import pathlib
|
||||
from rspeech.play import play_audio_async
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Chars to be ignored in speech
|
||||
IGNORE_CHARS = ["*", "#", "`","'",'"',"\\","/","---"]
|
||||
@ -105,7 +108,8 @@ async def tts(text:str ,google_project:str="lisa-448004", language_code:str="nl-
|
||||
with file.open("wb") as audio_file:
|
||||
audio_file.write(base64.b64decode(audio_content.encode('latin1')))
|
||||
async for tik in play_audio_async(file):
|
||||
await asyncio.sleep(0.1)
|
||||
logger.debug(tik)
|
||||
await asyncio.sleep(1)
|
||||
file.unlink()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user