Skip to content

Instantly share code, notes, and snippets.

@cdnsteve
Created December 20, 2019 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdnsteve/0fb57d7ba47a316fc606006efd4a79f8 to your computer and use it in GitHub Desktop.
Save cdnsteve/0fb57d7ba47a316fc606006efd4a79f8 to your computer and use it in GitHub Desktop.
Python boots and cats text to audio - works offline!
import pyttsx3
engine = pyttsx3.init()
rate = engine.getProperty('rate')
first_saying = 'And now for: boots and cats'
repeat_saying = 'and boots and cats '
engine.say(first_saying)
engine.setProperty('rate', 360)
n = 5
repeat_clean = ''
while n > 0:
n -= 1
repeat_clean = repeat_clean + repeat_saying
engine.say(repeat_clean)
engine.runAndWait()
engine.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment