(self)
| 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): |