Skip to content

Instantly share code, notes, and snippets.

@lcsouzamenezes
Forked from idcesares/tts.py
Created January 26, 2025 00:15
Show Gist options
  • Save lcsouzamenezes/a26f024400fca62a1d6a72da1eb11bc8 to your computer and use it in GitHub Desktop.
Save lcsouzamenezes/a26f024400fca62a1d6a72da1eb11bc8 to your computer and use it in GitHub Desktop.
Usando a biblioteca pyttsx3 para text-to-speech no Python
# Instalar o pyttsx3 com o comando abaixo:
# pip install pyttsx3
import pyttsx3
# Iniciando a biblioteca na variável engine
engine = pyttsx3.init()
# Função pronta para uso
def speak(speech):
engine.say(speech)
engine.runAndWait()
# Só chamar a função speak()
speak("Isto é um Quadrado!")
speak("Isto é um Triângulo!")
speak("Isto é uma Estrela!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment