CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 6140|回复: 0

cubieboard ubuntu 下 PocketSphinx 实时语音识别

[复制链接]
发表于 2013-12-4 10:39:32 | 显示全部楼层 |阅读模式
本帖最后由 gamexg 于 2013-12-4 10:49 编辑

我是在 arm cubieboard 下做的。

对了,在实际做之前先看一下 http://www.chenwang.net/2013/11/ ... ef%bc%881%ef%bc%89/ 文章里面有中文语音识别模型,下面的那个例子把中文模型注释掉了,如果需要的话可以下载下来和 03.py 放到一个目录。
  1. sudo apt-get install  gstreamer0.10-alsa    gstreamer0.10-tools   libgstreamer0.10-0   libgstreamer0.10-dev   python-gst0.10   python-gst0.10-dev   libgstreamermm-0.10-2    libgstreamermm-0.10-2 make gcc  g++  bison  libbison-dev  libasound2-dev libasound2-python python-alsaaudio python-pyalsa  python-gtk2  soundconverter vim




  2. sudo apt-get install  gstreamer0.10-alsa    gstreamer0.10-tools   libgstreamer0.10-0   libgstreamer0.10-dev   python-gst0.10   python-gst0.10-dev   libgstreamermm-0.10-2    libgstreamermm-0.10-2
  3. sudo apt-get install make gcc  g++
  4. sudo apt-get install  bison
  5. sudo apt-get install  libbison-dev
  6. sudo apt-get install  libasound2-dev libasound2-python python-alsaaudio python-pyalsa
  7. sudo apt-get install  python-gtk2
  8. sudo apt-get install  soundconverter

  9. wget http://downloads.sourceforge.net/project/cmusphinx/pocketsphinx/0.8/pocketsphinx-0.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fcmusphinx%2Ffiles%2Fpocketsphinx%2F0.8%2F&ts=1385189168&use_mirror=softlayer-dal
  10. mv pocketsphinx-0.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fcmusphinx%2Ffiles%2Fpocketsphinx%2F0.8%2F pocketsphinx-0.8.tar.gz
  11. wget http://downloads.sourceforge.net/project/cmusphinx/sphinxbase/0.8/sphinxbase-0.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fcmusphinx%2Ffiles%2Fsphinxbase%2F0.8%2F&ts=1385189298&use_mirror=softlayer-dal
  12. mv  sphinxbase-0.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fcmusphinx%2Ffiles%2Fsphinxbase%2F0.8%2F sphinxbase-0.8.tar.gz
  13. tar xzf sphinxbase-0.8.tar.gz
  14. cd sphinxbase-0.8
  15. ./configure
  16. make
  17. sudo make install
  18. cd ..
  19. export  LD_LIBRARY_PATH=/usr/local/lib
  20. export  PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  21. tar xzf pocketsphinx-0.8.tar.gz
  22. cd pocketsphinx-0.8
  23. ./configure
  24. make
  25. sudo make install
  26. pocketsphinx_continuous

  27. echo "export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-0.10/" >> ~/.bashrc
  28. echo "export LD_LIBRARY_PATH=/usr/local/lib/" >> ~/.bashrc

  29. export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-0.10/


  30. linaro@cubieboard:~/yysb$ cat 03.py
  31. import pygtk,gtk,gobject
  32. gobject.threads_init()
  33. import gst

  34. def result(asr, text, uttid): print text


  35. pipeline=gst.parse_launch('alsasrc device=1 ! audioconvert ! audioresample  ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink sync=false name=appsink')
  36. #pipeline=gst.parse_launch('alsasrc ! audioconvert ! audioresample  ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink sync=false name=appsink')
  37. #pipeline=gst.parse_launch('pulsesrc ! audioconvert ! audioresample  ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink sync=false name=appsink')
  38. #pipeline=gst.parse_launch('pulsesrc  ! tee  name=t ! queue ! audioconvert ! audioresample ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink    sync=false name=appsink  t. queue ! audioconvert ! audioresample ! wavenc ! filesink location=o.wav')
  39. asr=pipeline.get_by_name('asr')
  40. asr.connect('result', result)
  41. #asr.set_property('hmm', 'zh_broadcastnews_ptm256_8000')
  42. #asr.set_property('lm', '1.lm')
  43. #asr.set_property('dict', '1.dic')
  44. asr.set_property('configured', True)
  45. pipeline.set_state(gst.STATE_PLAYING)
  46. gtk.main()


  47. linaro@cubieboard:~/yysb$ python 03.py
复制代码
好了,现在可以测试了。

识别准确率固定几条命令的话识别率还行,但是会把其他的不相干的话识别成命令。现在正在尝试本地+在线语音识别,但是板子的音源输入只允许单个程序独占很烦人,现在正在考虑解决办法。

配置声卡:http://www.chenwang.net/2013/11/ ... %e9%85%8d%e7%bd%ae/

原文地址:http://www.chenwang.net/2013/11/23/ubuntu-%E4%B8%8B%E5%AE%89%E8%A3%85-pocketsphinx-with-gstreamer-and-python/

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-5-19 10:17 , Processed in 0.020720 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部