MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / speak

Function speak

DemoPrograms/Demo_Chatterbot_With_TTS.py:61–72  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

59 current_bar += 1
60
61def speak(text):
62 global i
63 tts = gTTS(text=text, lang='en',slow=False)
64 tts.save('speech{}.mp3'.format(i%2))
65 # playback the speech
66 mixer.music.load('speech{}.mp3'.format(i%2))
67 mixer.music.play()
68 # wait for playback to end
69 while mixer.music.get_busy():
70 time.sleep(.1)
71 mixer.stop()
72 i += 1
73
74i = 0
75mixer.init()

Callers

nothing calls this directly

Calls 3

saveMethod · 0.80
loadMethod · 0.80
stopMethod · 0.80

Tested by

no test coverage detected