Japanese speech output with open_jtalk

This is not as easy as espeak with English… and it looks like Japanes is not as easy as English. However here is what I had done:

download

  • http://packages.debian.org/wheezy/open-jtalk
  • libhtsengine1_1.06-1_amd64.deb
  • open-jtalk-mecab-naist-jdic_1.05-1_all.deb
  • open-jtalk_1.05-1_amd64.deb
  • hts-voice-nitech-jp-atr503-m001_1.04-1_all.deb
  • hts-voice-mei_1.1+dfsg-1_all.deb

 

found the right commands
I found a script to use open_jtalk on this page http://d.hatena.ne.jp/hecomi/20120221/1329838707


Here is my version modified version of the script:
~/bin/jspeak.sh

#/bin/sh
case "$1" in
1) echo "mei_angry"
VOICE=/usr/share/hts-voice/mei_angry
;;
2) echo "mei_bashful"
VOICE=/usr/share/hts-voice/mei_bashful
;;
3) echo "mei_happy"
VOICE=/usr/share/hts-voice/mei_happy
;;
4) echo "mei_normal"
VOICE=/usr/share/hts-voice/mei_normal
;;
5) echo "mei_sad"
VOICE=/usr/share/hts-voice/mei_sad
;;
*) echo "nitech-jp-atr503-m001"
VOICE=/usr/share/hts-voice/nitech-jp-atr503-m001
;;
esac
open_jtalk $2 \
-td $VOICE/tree-dur.inf \
-tf $VOICE/tree-lf0.inf \
-tm $VOICE/tree-mgc.inf \
-md $VOICE/dur.pdf \
-mf $VOICE/lf0.pdf \
-mm $VOICE/mgc.pdf \
-df $VOICE/lf0.win1 \
-df $VOICE/lf0.win2 \
-df $VOICE/lf0.win3 \
-dm $VOICE/mgc.win1 \
-dm $VOICE/mgc.win2 \
-dm $VOICE/mgc.win3 \
-ef $VOICE/tree-gv-lf0.inf \
-em $VOICE/tree-gv-mgc.inf \
-cf $VOICE/gv-lf0.pdf \
-cm $VOICE/gv-mgc.pdf \
-k $VOICE/gv-switch.inf \
-x /var/lib/mecab/dic/open-jtalk/naist-jdic/ \
-s 48000 \
-p 240 \
-a 0.58 \
-u 0.5 \
-jm 0.7 \
-jf 0.5 \
-l \
-z 48000 \
-ow ~/jpout.wav \
-ot ~/jpout.log
play ~/jpout.wav --norm

female voice
$ ~/bin/jpspeak.sh 2 jp.txt
male voice
$ ~/bin/jpspeak.sh 0 jp.txt

I use Geany text editor in Gnome to modify text files (it is very important that the encoding is set the EUC-JP or you get this error: WARNING: text2mecab() in text2mecab.c: Wrong character.) file and I configured a command in Geany to call the script, the only thing I need to do it to type something in Japanese and press F8 for male or F9 for female and it talks.

To install the Japanese keyboard in Ubuntu/Mint you need to go to Administration->Language Support and install Japanese and set input method to IBus (on mint you also need to install ibus). Under System->Keyboard Input Methods you will need to configure the short cut and add Japanese to the list. There are YouTube videos and lots of forum post that explain this in great detail.