RaspberryPiにOpenJTalkをインストールする
まずはopen-jtalk本体のインストール
$ sudo apt-get install open-jtalk Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libhtsengine1 Suggested packages: open-jtalk-mecab-naist-jdic hts-voice-nitech-jp-atr503-m001 The following NEW packages will be installed: libhtsengine1 open-jtalk 0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded. Need to get 187 kB of archives. After this operation, 542 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libhtsengine1 armhf 1.08-1 [38.0 kB] Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main open-jtalk armhf 1.07-2 [149 kB] Fetched 187 kB in 1s (132 kB/s) Selecting previously unselected package libhtsengine1. (Reading database ... 124920 files and directories currently installed.) Preparing to unpack .../libhtsengine1_1.08-1_armhf.deb ... Unpacking libhtsengine1 (1.08-1) ... Selecting previously unselected package open-jtalk. Preparing to unpack .../open-jtalk_1.07-2_armhf.deb ... Unpacking open-jtalk (1.07-2) ... Processing triggers for man-db (2.7.0.2-5) ... Setting up libhtsengine1 (1.08-1) ... Setting up open-jtalk (1.07-2) ... Processing triggers for libc-bin (2.19-18+deb8u1) ...
次に推奨パッケージの追加インストール
$ sudo apt-get install open-jtalk-mecab-naist-jdic hts-voice-nitech-jp-atr503-m001 Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: hts-voice-nitech-jp-atr503-m001 open-jtalk-mecab-naist-jdic 0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded. Need to get 10.9 MB of archives. After this operation, 68.2 MB of additional disk space will be used. Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main open-jtalk-mecab-naist-jdic all 1.07-2 [10.1 MB] Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/contrib hts-voice-nitech-jp-atr503-m001 all 1.05-1 [764 kB] Fetched 10.9 MB in 4s (2,617 kB/s) Selecting previously unselected package open-jtalk-mecab-naist-jdic. (Reading database ... 124936 files and directories currently installed.) Preparing to unpack .../open-jtalk-mecab-naist-jdic_1.07-2_all.deb ... Unpacking open-jtalk-mecab-naist-jdic (1.07-2) ... Selecting previously unselected package hts-voice-nitech-jp-atr503-m001. Preparing to unpack .../hts-voice-nitech-jp-atr503-m001_1.05-1_all.deb ... Unpacking hts-voice-nitech-jp-atr503-m001 (1.05-1) ... Setting up open-jtalk-mecab-naist-jdic (1.07-2) ... Setting up hts-voice-nitech-jp-atr503-m001 (1.05-1) ...
これだけだと音が出来ないので、参考リンクの内容を実行。
$ cd /opt/vc/src/hello_pi/ $ ./rebuild.sh $ speaker-test -t sine -f 600
waveのテスト。音がものすごく小さくて聞き取りが難しかった。
$ aplay /usr/share/sounds/alsa/Rear_Center.wav
ボリュームを調整する。以下のコマンドを実行するとダイアログが出るので上下させて調整する。
$ alsamixer -c 0
後はOpenJtalkでwavを作ってaplayで再生すれば発話する。
openjtalkはパラメータが非常に多い。
Ubuntu Open JTalk その2 - open_jtalkコマンドの説明 - kledgeb
$ vi say.sh #!/bin/sh if [ $# -ne 1 ]; then echo "invalid arguments. Usage: bash say.sh 'input_text'" exit 1; fi TMP=$($(cd $(dirname $0));pwd)/jsay.wav echo "$1" | open_jtalk \ -m /usr/share/hts-voice/nitech-jp-atr503-m001/nitech_jp_atr503_m001.htsvoice \ -x /var/lib/mecab/dic/open-jtalk/naist-jdic \ -ow $TMP && \ aplay --quiet $TMP rm -f $TMP
ローカルディレクトリにOpenJtalkでwaveファイルを作って、aplayで再生。
再生が終わったら削除する。
実行権限を付ける。
$ chmod u+x say.sh
使い方。
$ ./say.sh "ようやく話せるようになりました。ありがとうございます。"
続きはまた次回。