本帖最后由 gamexg 于 2013-12-4 10:49 编辑
- 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
-
-
-
-
- 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
- sudo apt-get install make gcc g++
- sudo apt-get install bison
- sudo apt-get install libbison-dev
- sudo apt-get install libasound2-dev libasound2-python python-alsaaudio python-pyalsa
- sudo apt-get install python-gtk2
- sudo apt-get install soundconverter
-
- 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
- mv pocketsphinx-0.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fcmusphinx%2Ffiles%2Fpocketsphinx%2F0.8%2F pocketsphinx-0.8.tar.gz
- 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
- mv sphinxbase-0.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fcmusphinx%2Ffiles%2Fsphinxbase%2F0.8%2F sphinxbase-0.8.tar.gz
- tar xzf sphinxbase-0.8.tar.gz
- cd sphinxbase-0.8
- ./configure
- make
- sudo make install
- cd ..
- export LD_LIBRARY_PATH=/usr/local/lib
- export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
- tar xzf pocketsphinx-0.8.tar.gz
- cd pocketsphinx-0.8
- ./configure
- make
- sudo make install
- pocketsphinx_continuous
-
- echo "export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-0.10/" >> ~/.bashrc
- echo "export LD_LIBRARY_PATH=/usr/local/lib/" >> ~/.bashrc
-
- export GST_PLUGIN_PATH=/usr/local/lib/gstreamer-0.10/
-
-
- linaro@cubieboard:~/yysb$ cat 03.py
- import pygtk,gtk,gobject
- gobject.threads_init()
- import gst
-
- def result(asr, text, uttid): print text
-
-
- pipeline=gst.parse_launch('alsasrc device=1 ! audioconvert ! audioresample ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink sync=false name=appsink')
- #pipeline=gst.parse_launch('alsasrc ! audioconvert ! audioresample ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink sync=false name=appsink')
- #pipeline=gst.parse_launch('pulsesrc ! audioconvert ! audioresample ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! appsink sync=false name=appsink')
- #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')
- asr=pipeline.get_by_name('asr')
- asr.connect('result', result)
- #asr.set_property('hmm', 'zh_broadcastnews_ptm256_8000')
- #asr.set_property('lm', '1.lm')
- #asr.set_property('dict', '1.dic')
- asr.set_property('configured', True)
- pipeline.set_state(gst.STATE_PLAYING)
- gtk.main()
-
-
- 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/
|