fix stuff

This commit is contained in:
2026-09-21 01:55:42 -04:00
commit 02d7c10f7d
26 changed files with 953 additions and 0 deletions

20
audio/gtts.py Normal file
View File

@@ -0,0 +1,20 @@
import os
import tempfile
import time
import pygame
from gtts import gTTS
def speak(text):
with tempfile.TemporaryDirectory() as tmpdirname:
temp_path = os.path.join(tmpdirname, "speech.mp3")
tts = gTTS(text=text,lang='en', tld='com')
tts.save(temp_path)
pygame.mixer.init()
pygame.mixer.music.load(temp_path)
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
time.sleep(0.1)
pygame.mixer.music.unload()
pygame.mixer.quit()