PocketSphinx error


7 posts
by StevenR » Fri Mar 15, 2013 7:43 pm
I've attempted to set up PocketSphinx (version 0.8) based on the instructions here:

https://sites.google.com/site/observing ... spberry-pi

I haven't been able to get it to access my USB soundcard. I've updated /etc/modprobe.d/alsa-base.conf so that it appears as the first audio device, but pocketsphinx_continuous gives the following error:

Error opening audio device (null) for capture: Connection refused
FATAL_ERROR: "continuous.c", line 246: Failed to open audio device

I've tried using the -adcdev option with pocketsphinx_continuous to set the audio device. I've tried hw:0 and hw:0,0 (and their plughw equivalents), and nothing seems to change except that the (null) in the error message is replaced with the device name used.

The arecord command works fine with the same device.

Does anyone have any ideas?
Posts: 2
Joined: Fri Mar 15, 2013 6:16 pm
by observing » Fri Mar 15, 2013 9:54 pm
From my experience, this error would raise the possibility that sphinxbase was either built before libasound2-dev was installed or the installation of libasound2-dev had a problem. If either situation occurs, sphinxbase will think that alsa isn't installed and default to OSS.
Posts: 30
Joined: Mon Feb 27, 2012 12:18 pm
by NickE » Sat Mar 16, 2013 12:14 am
I struggled quite a bit trying to get Pocketsphinx to work. I could not get it to work with pulseaudio. Pulseaudio would not see my (cheap) USB Sound device. I could arecord and aplay without problems.

Watching the ./configure progress, I could see that if pulseaudio was present, configure would skip trying to use ALSA. So, I uninstalled pulseaudio with the apt-get --purge. That was not enough. There were a couple of pulseaudio remnants (like the pulseaudio.h and libpulsecommon-2.0.so). I temporarily renamed those. Then I proceeded with

./configure
make
sudo make install

for both sphinxbase and pocketsphinx.

Again, watching the progress of ./configure, I could see that ALSA was finally accepted.

After that, I retested arecord and aplay. Assured that they worked, I then tried pocketsphinx_continuous. I had to use:

pocketsphinx_continuous -samprate 48000 -nfft 2048 -adcdev sysdefault

to get any kind of usable results with the default dictionaries.

The nfft parameter is needed to clear the frame size error. The adcdev parameter was required for pocketsphinx to find the mic even though it is the default.

There probably is a way to get it to work with pulseaudio, but once the above worked, I have not gone back. I will be reinstalling pulseaudio to see if it will coexist with pocketsphinx now that it is compiled.
Posts: 2
Joined: Sun Sep 09, 2012 5:50 pm
by observing » Sun Mar 17, 2013 12:43 am
That was a good catch, NickE. I'll add it as a cautionary note to my instructions.
Posts: 30
Joined: Mon Feb 27, 2012 12:18 pm
by StevenR » Sun Mar 17, 2013 9:18 am
NickE wrote:Watching the ./configure progress, I could see that if pulseaudio was present, configure would skip trying to use ALSA. So, I uninstalled pulseaudio with the apt-get --purge. That was not enough. There were a couple of pulseaudio remnants (like the pulseaudio.h and libpulsecommon-2.0.so). I temporarily renamed those.


Thanks for that, that got Pocketsphinx working for me.
I actually didn't need to rename anything, such as pulseaudio.h. I simply had to uninstall libpulse-dev (apt-get --purse remove libpulse-dev) to get rid of them.
Posts: 2
Joined: Fri Mar 15, 2013 6:16 pm
by danjperron » Fri Mar 29, 2013 9:01 pm
I got pocketsphinx 0.8 working on my raspberrypi using the microphone on the webcam. I used the instruction from http://codebangers.com/?p=678 except I didn't change the alsa device order.
I use this command
Code: Select all
pocketsphinx_continuous -adcdev hw:1,0  -nfft 2048 -samprate 48000

Now I will like to change the model and dictionary to french.
But when I use
Code: Select all
./pocketsphinx_continuous -adcdev hw:1,0 -hhm  -lm /usr/src/language/french3g62k.Im.dmp -dic /usr/src/frenchWords62K.dic
it doesn't recognize the new model! It is still in english.
Daniel
Posts: 117
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada
by danjperron » Fri Mar 29, 2013 11:40 pm
Ok I took out -hhm and now it is in french. But recognition in french doesn't work very well!

I will check how to do my own dictionary and model. bummer!

Daniel
Posts: 117
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada