Skip to content

Instantly share code, notes, and snippets.

@goddoe
Created March 20, 2020 09:54
Show Gist options
  • Save goddoe/882c93892b519ee0eb52af76c8eda689 to your computer and use it in GitHub Desktop.
Save goddoe/882c93892b519ee0eb52af76c8eda689 to your computer and use it in GitHub Desktop.
tts
from gtts import gTTS
from pygame import mixer
import mutagen.mp3
while True:
query = input("query: ")
tts = gTTS(text=query, lang='ko')
tts.save("./out.mp3")
mp3 = mutagen.mp3.MP3("./out.mp3")
mixer.init(frequency=mp3.info.sample_rate)
mixer.music.load("./out.mp3")
mixer.music.play()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment