Created
January 23, 2019 10:45
-
-
Save mickey-happygolucky/a70db98e17b06ce65945edb2b8c9fc1a to your computer and use it in GitHub Desktop.
open_jtalk python sample with yocto
This file contains 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
# coding=utf-8 | |
import os | |
import subprocess | |
def talk(s): | |
model = '/usr/share/Voice/mei/mei_happy.htsvoice' | |
dic = '/usr/share/dic' | |
wav = '/tmp/talk.wav' | |
txt = '/tmp/talk.txt' | |
with open(txt, mode='w') as f: | |
f.write(s) | |
command = 'open_jtalk -m %s -x %s -ow %s %s' % (model, dic, wav, txt) | |
subprocess.call(command.strip().split(' ')) | |
os.remove(txt) | |
command = 'aplay %s' % wav | |
subprocess.call(command.strip().split(' ')) | |
os.remove(wav) | |
if __name__ == '__main__': | |
talk('日本語をしゃべります') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment