Async update.

This commit is contained in:
retoor 2025-01-18 15:42:26 +01:00
parent 2c319b5492
commit 031a6d9144
2 changed files with 2 additions and 2 deletions

View File

@ -104,7 +104,7 @@ async def tts(text:str ,google_project:str="lisa-448004", language_code:str="nl-
file = pathlib.Path(str(uuid.uuid4()) + ".mp3") file = pathlib.Path(str(uuid.uuid4()) + ".mp3")
with file.open("wb") as audio_file: with file.open("wb") as audio_file:
audio_file.write(base64.b64decode(audio_content.encode('latin1'))) audio_file.write(base64.b64decode(audio_content.encode('latin1')))
async for tik in play_audio(file) async for tik in play_audio(file):
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
file.unlink() file.unlink()
return return

View File

@ -33,7 +33,7 @@ import pygame
import time import time
async def play_audio_async(filename) async def play_audio_async(filename):
pygame.mixer.init() pygame.mixer.init()
pygame.mixer.music.load(filename) pygame.mixer.music.load(filename)
time_start = time.time() time_start = time.time()