Menu

cmd_ln_parse_r error pocketsphinx_continuous

Help
Phaelaep
2010-01-18
2012-09-22
  • Phaelaep

    Phaelaep - 2010-01-18

    Hello,
    I am a bit of a noob with respect to pocketsphinx so I might be dealing with a
    simple problem but I guess it doesn't hurt to try anyway. I have been getting
    a "cmd_ln_parse_r failed" error while running pocketsphinx_continuous which I
    traced following the error to the utility file "cmd_ln.c", line 648 found in
    libsphinxbase. (That was the line displayed by the error). Having looked
    around I have come to believe it is a missing configuration file being
    requested by sphinxbase. having installed pocketsphinx on 3 separate laptops
    and one smartphone (all running ubuntu distros), I have gotten pocketsphinx to
    work only on one (it worked right off the bat using the same svn checkout
    method of installation.) On the other two laptops including the smartphone, I
    keep getting this error which I can't seem to resolve. Any ideas?
    pocketsphinx_tidigits seems to attain a ready state though although I've not
    been able to get it to recognize the input from the usb microphone. Thanks.

     
  • Nickolay V. Shmyrev

    Having looked around I have come to believe it is a missing configuration
    file being requested by sphinxbas

    No, the issue is that you provided incorrect configuration options. Since you
    didn't mention what options are you using to initialize the decoder it's hard
    to say what have you done wrong exactly. Usually you can just look at options
    and their values and find a typo or missing space. Or write them here, we'll
    find it for you.

    Any ideas? pocketsphinx_tidigits seems to attain a ready state though
    although I've not been able to get it to recognize the input from the usb
    microphone

    By default pocketsphinx records from default device. You probably need to
    point the input device name with -adcdev option of the pocketsphinx
    continuous. You can find list of the devices with "arecord -l". Read alsa
    introduction for more details.

     
  • Phaelaep

    Phaelaep - 2010-01-19

    Hello,
    Thanks for your reply. The issue with the usb microphone has been fixed thanks
    to you and I've successfully tested speech recognition on working laptop. The
    problem is with the other machines. What I had done earlier was I had after
    downloading sphinxbase and pocketsphinx using subversion, I simply ran make
    and make install after the ./autogen.sh --prefix=/usr. Then having installed
    pocketsphinx, i ran the command pocketsphinx_continuous and
    pocketsphinx_tidigits. pocketsphinx_tidigits went to the ready state while
    pocketsphinx_continuous brought up the cmd_ln_parse_r failed error. I tried
    reinstalling pocketsphinx after reading your post sort of as a backtrack and
    this time I ran a make check with produced the following error: (I simply
    copied the only failed test because the rest had returned a pass so I didn't
    bother.)

    /bin/bash: line 4: 2872 Segmentation fault ${dir}$tst
    FAIL: test_lm_read
    ......
    ......
    .....
    ====================
    4 of 25 tests failed
    ====================
    make: *** Error 1
    make: Leaving directory /usr/src/sphinx/pocketsphinx/test/unit' make: *** Error 2 make: Leaving directory/usr/src/sphinx/pocketsphinx/test/unit'
    make: *** Error 1
    make: Leaving directory `/usr/src/sphinx/pocketsphinx/test'
    make: *** Error 1

    I had obviously missed this during the earlier installation, so hopefully this
    gives more information on the problem. I appreciate the feedback.

     
  • Nickolay V. Shmyrev

    pocketsphinx_continuous brought up the cmd_ln_parse_r failed error.

    It should do so since you need to specify it hmm model folder, dictionary and
    a language model as options. Look inside pocketsphinx_tidigits script for
    sample. In the beginning it wrote you a hint:

    ERROR: "cmd_ln.c", line 630: No arguments given, exiting

    4 of 25 tests failed

    it happens with the development version of pocketsphinx. If you need working
    tests, use released version please.

     
  • Phaelaep

    Phaelaep - 2010-01-20

    I'm sorry if this appears extremely newbish but I have not been able to get to
    change the usb mic recognized by pocketsphinx. I tried the command
    pocketsphinx_continuous -adcdev hw:1,0 (where hw:1,0 corresponds to my usb
    microphone but was unable to get anything other than an error telling me to
    specify -hmm location or something. Right now I am simply trying to test run
    pocketsphinx_tidigits but I can't because it won't recognize my usb microphone
    (although alsa does: I can succesfully run arecord). Can anyone provide a
    command line that I can use to simply have pocketsphinx recocgnize my mic and
    run pocketsphinx_tidigits? The usb mic is on card 0, subdevice 0 and we can
    assume the name to be <usbmic>. I know it seems like spoonfeeding but google
    turns up very little information for a beginner like me and I have already
    tried too many options with no success. Thanks.</usbmic>

     
  • Phaelaep

    Phaelaep - 2010-01-20

    Just to clear up any confusion the earlier post which stated that I had gotten
    usb working was due to the fact that I had already set the usb as the default
    device on the earlier working computer (outside pocketsphinx) and had
    forgotten, so though the earlier command had given me errors, I had assumed it
    to have worked somehow (yeah... not the smartest thing). So I would really
    appreciate any assistance on the above. Oh and the usb mic is actually oncard
    1, subdevice 0.
    Thank you.

     
  • Nickolay V. Shmyrev

    You need to add adcdev hw:1,0 inside pocketsphinx_tidigits script:

    $S2CONTINUOUS \
    -adcdev hw:1,0 \
    -fwdflat no -bestpath no \
    -lm ${LMFILE} \
    -dict ${DICT} \
    -hmm ${HMM} \
    -samprate 8000 \
    -nfft 256 $@

     
  • Phaelaep

    Phaelaep - 2010-01-22

    Okay as per your suggestion I've tried appending all of the following to the
    pocketsphinx_ tidigits script:
    -adcdev hw:1,0 \
    -adcdev hw:1 \

    I even went further and following the instructions here:
    https://sourceforge.net/projects/cmusphinx/forums/forum/5471/topic/2828780 i
    tried:

    -adcdev plughw:1,0 \
    -adcdev plughw:1 \

    However I still get the error:

    ad_oss.c(103): Failed to open audio device(any of the above) No such file or
    directory

    Here is my arecord -l output:

    * List of CAPTURE Hardware Devices *
    card 0: Intel , device 0: ALC880 Analog
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 0: Intel , device 4: ALC880 Analog
    Subdevices: 2/2
    Subdevice #0: subdevice #0
    Subdevice #1: subdevice #1
    card 1: U0xd8c0x0c , device 0: USB Audio
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    Based on the how to here
    http://www.voxforge.org/home/forums/message-boards/speech-recognition-engines
    /howto-use-pocketsphinx?pn=2

    I also tried

    -adcdev U0xd8c0x0c /
    - adcdev hw:U0xd8c0x0c /
    -adcdev plughw: U0xd8c0x0c /

    My pocketsphinx_tidigits script as of right now stands as thus:

    $S2CONTINUOUS \
    -adcdev plughw:U0xd8c0x0c \
    -fwdflat no -bestpath no \
    -lm ${LMFILE} \
    -dict ${DICT} \
    -hmm ${HMM} \
    -samprate 8000 \
    -nfft 256 $@

    The present error is:
    ad_oss.c(103): Failed to open audio device(plughw:U0xd8c0x0c): No such file or
    directory
    FATAL_ERROR: "continuous.c", line 259: ad_open_dev failed

    Which leaves me at odds as to what to do now since my USB mic is at present my
    sole means of audio capture. So any other microphone is presently out of the
    question.
    Any other suggestions?

     
  • Phaelaep

    Phaelaep - 2010-01-22

    Oh, I have also tried setting my usb as the default microphone but
    pocketsphinx_tidigits still doesn't detect any audio input. Meanwhile using

    arecord -f cd -D plughw:1,0 -d 20 test.wav
    and
    aplay -D plughw:1,0 test.wav
    and I was able to playback a sound recording of myself so the microphone works
    and is detected. This is just some extra information that might be useful. I
    really appreciate the help.

     
  • Nickolay V. Shmyrev

    Hi, from

    ad_oss.c(103): Failed to open audio device(plughw:U0xd8c0x0c): No such file
    or directory

    It looks like you compiled pocketsphinx with oss audio backend. That's
    probably because alsa headers were not installed. Could you please try to
    compile it with alsa. Check config.log in sphinxbase for the reason of
    problems:

    configure:9065: checking alsa/asoundlib.h usability
    configure:9082: gcc -c -g -O2 -Wall  conftest.c >&5
    configure:9089: $? = 0
    configure:9103: result: yes
    configure:9107: checking alsa/asoundlib.h presence
    configure:9122: gcc -E  conftest.c
    configure:9129: $? = 0
    configure:9143: result: yes
    configure:9171: checking for alsa/asoundlib.h
    configure:9178: result: yes
    configure:9192: checking for snd_pcm_open in -lasound
    configure:9227: gcc -o conftest -g -O2 -Wall   conftest.c -lasound  -lpthread -lm  >&5
    configure:9234: $? = 0
    configure:9255: result: yes
    
     
  • Phaelaep

    Phaelaep - 2010-01-22

    Well, that's definitely new. It seems I'd have to reinstall pocketsphinx then?
    How do I compile with alsa? Is there a way it can still be used with the oss
    backend?
    Thanks.

     
  • Nickolay V. Shmyrev

    Well, that's definitely new. It seems I'd have to reinstall pocketsphinx
    then?

    You need to recompile and reinstall sphinxbase

    How do I compile with alsa?

    Just make sure alsa is properly installed

    Is there a way it can still be used with the oss backend?

    yes, but adcdev should be something likde /dev/dsp1 then I suppose

     
  • Nickolay V. Shmyrev

    Hello wilhemina. As of today, all tests should pass without issues.

     
  • Phaelaep

    Phaelaep - 2010-02-04

    Hey nshmyrev,
    Thanks a bunch for your help. The problem was solved by appending dev/dsp1 to
    the pocketsphinx_tidigits script. It worked flawlessly and i have also been
    able to pass on the same arguments to pocketsphinx_continuous running my own
    custom language model and dictionary.

    I do have a final request/question. Do you have any idea about how to use
    pocketsphinx in starting an application with speech? (for instance using
    pocketsphinx to open a browser) I understand this might require a whole new
    thread but an overview of some sort or a link to where I can get started would
    be most helpful.
    Thanks again!

     
  • Nickolay V. Shmyrev

    Do you have any idea about how to use pocketsphinx in starting an
    application with speech

    Application invocation in Linux could be done with system() call

    http://linuxmanpages.com/man3/system.3.php

    or with fork/exec

    I understand this might require a whole new thread

    no

     
  • Phaelaep

    Phaelaep - 2010-02-05

    Okay, but how does one implement it? Is there a pipe command for linux that
    can enable it to run a script or executable from terminal or does one have to
    directly add a command to the pocketsphinx _continuous source code using
    include (system). I am trying to use pocketsphinx to execute a variety of
    applications like browser, terminal, voice control as well as any scripts I
    might manually create. My overall aim is to write a software which eliminates
    keyboard and mouse input and depends solely only speech recognition.

     
  • Nickolay V. Shmyrev

    Okay, but how does one implement it?

    One would take a text editor or start an IDE and will write the code.

    Is there a pipe command for linux that can enable it to run a script or
    executable from terminal

    pocketsphinx_continuous -args .... 2>&1 | while read line; do
    if line .....
    run command
    fi
    done

    l or does one have to directly add a command to the pocketsphinx _continuous
    source code using include
    (system).

    This is also possible

    I am trying to use pocketsphinx to execute a variety of applications like
    browser, terminal, voice control as well as
    any scripts I might manually create. My overall aim is to write a software
    which eliminates keyboard and mouse input and
    depends solely only speech recognition.

    That's a great goal. I'm sure you'll succeed!

     
  • Phaelaep

    Phaelaep - 2010-02-12

    Thanks. I was thinking of using a JAVA IDE though. I'm trying to use JAVA as
    an interface between pocketsphinx and the Linux OS. How does one use java to
    make a call to pocketshinx thus enabling JAVA to serve as a interface to
    different aspects of the operating system? Would you know any links to anyone
    that has done this?

     
  • Nickolay V. Shmyrev

    I was thinking of using a JAVA IDE though.

    What about switching to sphinx4 then, it will be way easier to use it from
    java?

    How does one use java to make a call to pocketshinx

    http://en.wikipedia.org/wiki/Java_Native_Interface

     
  • Phaelaep

    Phaelaep - 2010-02-18

    Okay, I have written a script which causes linux to search inside a text file
    and start an application based on whichever strings it locates in that file.
    Now I need to incorporate it inside pocketsphinx so as to have pocketsphinx
    continuously reference the script at runtime This is so as to have linux run a
    search on the speech generated commands which I have piped to a custom text
    file I created. Can you tell me the location of the pocketsphinx source code
    after installation or is there an easier way of doing this? I thought of
    writing a control script to start up pocketsphinx but it has no way of
    accessing the continuous loop that causes pocketsphinx to go into a ready
    state after each recognition. It is at that instance I would need the script
    to do a search for the recognized word and execute a command. Thanks for the
    help!

     
  • Nickolay V. Shmyrev

    Sorry, I haven't got your question.

     
  • Phaelaep

    Phaelaep - 2010-02-20

    Okay I'll rephrase. Imagine I have an application like 'mplayer' which i'd
    like to run only when the words 'start video player' are recognized by
    pocketsphinx. Right now, I would like application to run thus:

    pocketsphinx launches -> goes into 'READY' state awaiting input from user
    -> User says 'start video player' -> ** mplayer runs ->** meanwhile
    pocketsphinx is back in the READY state.It means while pocketsphinx is within
    the loop (from recognition to ready state) it should execute the command
    before it returns to the READY state.

    RIght now, using bash scripting. It only runs the application after
    pocketsphinx terminates, which means I might have to write a function to make
    an application call from within the pocketsphinx source code. Or at least to
    reference my script WITHIN that loop. If I am correct what would the name of
    that source file be and where would its location be? If I am not correct is
    there a cleaner solution to the problem above?

     
  • Phaelaep

    Phaelaep - 2010-02-20

    So pretty much my question is... how do you tackle the above problem using
    pipe (from terminal) and/or from within the pocketsphinx_continuous source
    code?

     
  • Nickolay V. Shmyrev

    how do you tackle the above problem using pipe (from terminal)

    I wrote you above

    pocketsphinx_continuous -hmm
    /home/shmyrev/local/share/pocketsphinx/model/hmm/wsj1/ -lm
    /home/shmyrev/local/share/pocketsphinx/model/lm/wsj/wlist5o.3e-7.vp.tg.lm.DMP
    -dict /home/shmyrev/local/share/pocketsphinx/model/lm/wsj/wlist5o.dic 2>&1 |
    while read line; do match=echo $line | grep THE; if ; then echo "RUNNING
    IT"; fi; done

    and/or from within the pocketsphinx_continuous source code? If I am correct
    what would the name of that source file be and where would its location be?

    It's continuous.c in pocketsphinx/src/programs/

     

Log in to post a comment.