Skip to content

Instantly share code, notes, and snippets.

@kittinan
Created March 23, 2018 03:33
Show Gist options
  • Select an option

  • Save kittinan/3f2df0c3c36e5a1812e9f58955ff5571 to your computer and use it in GitHub Desktop.

Select an option

Save kittinan/3f2df0c3c36e5a1812e9f58955ff5571 to your computer and use it in GitHub Desktop.
Raspberry PI Thai TTS and speak
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