安装后我试图从pocketsphinx源运行liveemo.py并偶然发现pocketsphinx问题。缩小范围,问题出在pocketsphinx gsteamer插件上。
简单地运行这个:
gst-launch-0.10 autoaudiosrc ! audioconvert ! audioresample ! vader name=vad auto-threshold=true ! pocketsphinx name=asr ! fakesink
产生这个调试输出(GST_DEBUG=*:2):
...
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstAudioSrcClock
0:00:00.074397000 89084 0x7fe358c38690 WARN osxaudiosrc gstosxaudiosrc.c:292:gst_osx_audio_src_io_proc:<osxringbuffer0> AudioUnitRender returned -10863
0:00:00.085992000 89084 0x7fe358c38690 WARN osxaudiosrc gstosxaudiosrc.c:292:gst_osx_audio_src_io_proc:<osxringbuffer0> AudioUnitRender returned -10863
0:00:00.097520000 89084 0x7fe358c38690 WARN osxaudiosrc gstosxaudiosrc.c:292:gst_osx_audio_src_io_proc:<osxringbuffer0> AudioUnitRender returned -10863
...
没有任何东西可以通过pocketsphinx,当然也没有语音识别。相比之下,这条线输出的录音没有问题:
gst-launch-0.10 osxaudiosrc ! audioconvert ! audioresample ! wavenc ! filesink location=temp.wav
设置:我用 Homebrew 和 Macports 在 OS X Lion 和 Yosemite 上进行了尝试。这是我在使用 macports 时所做的:
sudo port install python27
sudo port install python_select
sudo port select --set python python27
sudo port install py27-pygtk
sudo port install gstreamer010 gstreamer010-gst-plugins-bad gstreamer010-gst-plugins-good gstreamer010-gst-plugins-ugly
sudo port install py27-gst-python
构建和安装 sphinxbase 和 pocketsphinx
sudo port install swig swig-python
git clone https://github.com/cmusphinx/sphinxbase.git
git clone https://github.com/cmusphinx/pocketsphinx.git
cd sphinxbase/
./autogen.sh
./configure --prefix=/opt/local/ --disable-debug --disable-dependency-tracking
sudo make install
cd ../pocketsphinx && ./autogen.sh
./configure --prefix=/opt/local/ --disable-dependency-tracking && sudo make install