MCPcopy Index your code
hub / github.com/geekcomputers/Python / play_only

Method play_only

text_to_audio/main.py:81–93  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

79 self.gtts_object.save(filename)
80
81 def play_only(self):
82 from pygame import mixer, time
83
84 tts = self.gtts_object
85 fp = BytesIO()
86 tts.write_to_fp(fp)
87 fp.seek(0) # Reset the BytesIO object to the beginning
88 mixer.init()
89 mixer.music.load(fp)
90 mixer.music.play()
91 while mixer.music.get_busy():
92 time.Clock().tick(10)
93 # Consider using a different method for playing audio, Pygame might not be optimal
94
95 # Object initialisation please.
96 # def save_path(self):

Callers 1

main.pyFile · 0.80

Calls 2

playMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected