import os | |
from gtts import gTTS | |
print("馃摑 Escribe o pega tu texto de presentaci贸n. Termina con Enter + Ctrl+D (en Linux):\n") | |
# Leer texto completo desde stdin | |
try: | |
texto = "" | |
while True: | |
linea = input() | |
texto += linea + "\n" | |
except EOFError: | |
pass | |
# Guardar texto | |
with open("guion.txt", "w", encoding="utf-8") as f: | |
f.write(texto) | |
# Convertir a voz | |
tts = gTTS(text=texto, lang="es") | |
tts.save("guion.mp3") | |
# Reproducir | |
print("馃攰 Reproduciendo tu presentaci贸n con voz generada...") | |
os.system("mpg123 guion.mp3 || ffplay -nodisp -autoexit guion.mp3") | |