| 1 | import subprocess |
| 2 | from plyer.facades import TTS |
| 3 | from plyer.utils import whereis_exe |
| 4 | |
| 5 | |
| 6 | class EspeakTextToSpeech(TTS): |
| 7 | ''' Speaks using the espeak program |
| 8 | ''' |
| 9 | def _speak(self, **kwargs): |
| 10 | subprocess.call(["espeak", kwargs.get('message')]) |
| 11 | |
| 12 | |
| 13 | def instance(): |
| 14 | if whereis_exe('espeak.exe'): |
| 15 | return EspeakTextToSpeech() |
| 16 | return TTS() |