ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

pocketsphinx microphone connection is unreliable

asked 2014-07-07 09:58:40 -0500

Alex Brown gravatar image

Hi, I have pocketsphinx installed with hydro and raring ubutu (13.04). I've done the standard installation with gstreamer0.10-pocketsphinx, ros-hydro-pocketsphinx, ros-hydro-audio-common and libasound2.

When it works, it works quite well and will run for hours. However, often when I start it up, it does not respond to the microphone at all. The microphone is still working according to the Sound Settings input page, but pocketsphinx just doesn't seem to receive the input. After it has been running properly, I can just stop it with control C and start it again and it may or may not work properly. No changes are made between stopping and starting it.

I assume that the mike data is getting lost somewhere in the gstreamer connection; but troubleshooting this connection is out of my experience. Online search has many examples of problems in this area, but none of the proposed solutions seem to help. I found gstreamer-properties which seems to allow selection of pulseaudio and my specific microphone; but doesn't make any difference.

Any suggestions will be appreciated. Thanks, Alex

edit retag flag offensive close merge delete


A few generic points to help troubleshooting. Compare top results when the bug happens and during normal operation. See if there is a process taking more time. Also, it might be that some process went to sleep mode, like a power save feature.

ccapriotti gravatar image ccapriotti  ( 2014-07-07 11:22:06 -0500 )edit

Well, what I could see is that PulseAudio %CPU goes up about 50% (10% go 15% roughly) when pocketsphinx is working. I read up on PulseAudio and added some of the tools which made me think I had it fixed. But it went back to not working after 8 or 10 restarts. I'm going to follow up on MIke's answer below.

Alex Brown gravatar image Alex Brown  ( 2014-07-07 16:21:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-07-07 15:13:48 -0500

fergs gravatar image

I've not used 13.04, but on 14.04 I found that pulseaudio+gstreamer was problematic. I found that I could get a more reliable system using ALSA. I've thus added a new parameter "~source" which can be used to specify an arbitrary source input, for instance "alsarsrc" has worked well for me. This is not in debs yet, you would have to install from source ( )

(for reference, the commit is )

edit flag offensive delete link more


Hi Mike, The commit link above took me to your indigo release. I assume you are talking about the program. As far as I can see it is just like my hydro version which has a "~source" parameter. I had tried before to use the _device_name_param with no luck. But, my python is pretty basic (or less) and I don't recognize the syntax on the rospy.has_param arguments. I was assuming "self._device_name_param" was a local param. Is '~source' a global param? My pacmd list-sources doesn't have a 'alsasrc' listing, just much longer names. Do I just add a to my global params in my launch file?

Alex Brown gravatar image Alex Brown  ( 2014-07-07 16:34:05 -0500 )edit

OK, I figured it out. I'm going to have to learn to work with python programs. Your solution works, the param is local (s/b 'private') so I just added it to my pocketsphinx launch file. Pocketsphinx has opened successfully 20 time in a row. this far exceeds the previous record so I think it is fixed. This was with the ros-hydro-pocketsphinx version of your program just loaded by apt-get. Thanks!

Alex Brown gravatar image Alex Brown  ( 2014-07-08 08:43:28 -0500 )edit

Worked perfectly after modifying the source. Thanks buddy!!!

R@m gravatar image R@m  ( 2016-09-20 23:59:18 -0500 )edit

Question Tools

1 follower


Asked: 2014-07-07 09:58:40 -0500

Seen: 602 times

Last updated: Jul 07 '14