aoirint's note

メモ帳

Open JTalk

Open JTalk

# Open JTalk Test
# python3
# exec `apt install open-jtalk open-jtalk-mecab-naist-jdic`
# get `mei_normal.htsvoice` from http://www.mmdagent.jp/

import subprocess

p = subprocess.Popen('open_jtalk -x /var/lib/mecab/dic/open-jtalk/naist-jdic -m mei/mei_normal.htsvoice -r 1.0 -ow /dev/stdout', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

text = 'こんにちは'
out, err = p.communicate(text.encode('utf-8'))

print(text)
print(err)

# outにwavのバイナリが入ってる。必要に応じてここ変えてね
with open('b.wav', 'wb') as fp:
    fp.write(out)

See

  • mpg123