LoginSignup
33
31

More than 3 years have passed since last update.

Raspberry piでjuliusを使用して音声認識

Last updated at Posted at 2017-10-24

ストックじゃなくて、いいねください。

juliusを使用して音声認識

準備物

- Raspberry Pi(今回は3)

Raspberry Piに入れるって言ってるのにないわけないだろ

- USBマイク

juliusのインストール

$ wget https://github.com/julius-speech/julius/archive/v4.4.2.tar.gz
$ tar zxvf v4.4.2.tar.gz
$ cd julius-4.4.2
$ ./configure
$ make
$ make install
$ julius -version

v4.4.2のところは最新のversionを指定してください。

juliusの実行キット(ディクテーションキットと記述文法音声認識実行キット)のインストール

~/julius-4.4.2$ mkdir julius-kit
~/julius-4.4.2$ cd julius-kit
$ wget --trust-server-names 'http://osdn.jp/frs/redir.php?m=iij&f=%2Fjulius%2F60416%2Fdictation-kit-v4.3.1-linux.tgz'
$ wget https://github.com/julius-speech/grammar-kit/archive/v4.3.1.zip
$ tar zxvf dictation-kit-v4.3.1-linux.tgz
$ unzip v4.3.1.zip

容量が大きいため少し時間がかかります。なるべく回線のいい環境でのダウンロードを推奨します。

~/julius-4.4.2
|--julius-kit
       |--dictation-kit-v4.3.1
       |--grammer-kit-v4.3.1

juliusの実行

ディクテーションキットを使用した場合

$ cd dictation-kit-v4.3.1
$ julius -C main.jconf -C am-gmm.jconf -demo   
///homeから実行する場合
$ cd ~   
$ julius -C ~/julius-4.4.2/julius-kit/dictation-kit-v4.3.1-linux/main.jconf -C ~/julius-4.4.2/julius-kit/dictation-kit-v4.3.1-linux/am-gmm.jconf -demo

記述文法音声認識実行キットを使用した場合

$ cd grammer-kit-v4.3.1
$ julius -C testmic.jconf -charconv SJIS UTF-8
///homeから実行する場合
$ cd ~
$ julius -C ~/julius-4.4.2/julius-kit/grammer-kit-v4.3.1/testmic.jconf -charconv SJIS UTF-8   

もしエラーが出て実行されない場合

### read waveform input
Stat: adin_oss: device name = /dev/dsp (application default)
Error: adin_oss: failed to open /dev/dsp
failed to begin input stream
  • そもそもマイクがささってない(自分やっちゃった・・・)
  • マイクに問題がない場合
$ sudo modprobe snd-pcm-oss   
$ sudo sh -c "echo snd-pcm-oss >> /etc/modules"
$ export AUDIODEV=/dev/dsp1

今までは毎回起動時にexport AUDIODEV=/dev/dsp1
を行っていましたが、めんどくさいのでラズパイの設定を変えましょう。

$ sudo emacs /etc/profile

profileファイルの最後に
export AUDIODEV=/dev/dsp1を追加してください。
追加して、保存すると再起動してください。
それで毎回のexport AUDIODEV=/dev/dsp1する必要はなくなります。

 実行結果

<<< please speak >>>

と表示され、音声入力待ちになると成功

まとめ

一応認識はできました。
しかし、そのまま使用しても認識率がよくないので辞書を作りましょう。
作り方はこちら
docomoAPIの音声認識などいくつか試して音声認識をどれで行うか決めることにしましょう。
あとマイクはある程度いいやつにしましょう。安いやつだとガバガバ・・・( ́・ω・ )

33
31
12

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
33
31