Async update.
This commit is contained in:
parent
2c319b5492
commit
031a6d9144
@ -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
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user