Created
March 23, 2018 03:33
-
-
Save kittinan/3f2df0c3c36e5a1812e9f58955ff5571 to your computer and use it in GitHub Desktop.
Raspberry PI Thai TTS and speak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| from gtts import gTTS | |
| def play_mp3(path): | |
| subprocess.Popen(['mpg123', '-q', path]).wait() | |
| text = "สวัสดี" | |
| tts = gTTS(text=text, lang='th') | |
| tts.save("hello.mp3") | |
| play_mp3("hello.mp3") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment