Menu

sphinxbase continuous listener c-api

Help
2012-09-10
2013-09-20
  • Scott Silliman

    Scott Silliman - 2012-09-10

    Hi,

    For a system which doesn't allow barge in, am I supposed to:

    //end of previous user response
    ad_stop_rec()
    //prompt user
    cont_ad_reset()
    ad_start_rec()
    //listen to user response.
    ad_stop_rec()
    //and so on...

    I'm currently puzzled why when I call ad_start_rec(), I'm getting all of the
    audio since the previous ad_stop_rec(). Is this the expected behavior?

    -Scott

     
  • Nickolay V. Shmyrev

    Which ad backend are you using? Alsa, oss or pulse?

     
  • Scott Silliman

    Scott Silliman - 2012-09-11

    pulse.

     
  • Scott Silliman

    Scott Silliman - 2012-09-12

    hmm, I disabled pulseaudio, and jack, had some issues with alsa (may have been
    simply a bad .asoundrc), so I switched to oss (I'm sure it's actually alsa-oss
    though) and that did the trick. I've found that the different backends cause
    cont_ad_read() to act differently, pulseaudio will block, while oss causes
    your listen loop to iterate thousands of times. Anyway it works.

    any chance sphinxbase's configure script could get some options to --disable-
    pulseaudio, --disable-jack, etc. Currently, if you have the headers and
    libraries installed it will use whatever it finds first. I couldn't figure out
    any way to disable pulseaudio, jack, or alsa except uninstalling the headers
    for them.

     
  • Nickolay V. Shmyrev

    any chance sphinxbase's configure script could get some options to
    --disable-pulseaudio, --disable-jack, etc.

    The chance is 100% if you submit the patch.

     
  • Nickolay V. Shmyrev

    And a better way be to implement missing stop function in ad_pulse so
    pulseaudio would work properly.

     
  • Scott Silliman

    Scott Silliman - 2012-10-13

    sorry about the late reply.

    ad_stop_rec() IS in ad_pulse.c, but doesn't actually make any calls to the pulseaudio api.

    I think that by simply adding a call to pa_simple_flush() in ad_start_rec() would achieve the proper behavior, don't you think?

    The documentation for ad_start_rec() simply says "starts audio recording". I wouldn't think that other users would be expecting audio input buffered prior to this call to be preserved, would you?

     
  • Nickolay V. Shmyrev

    I think that by simply adding a call to pa_simple_flush() in ad_start_rec() would achieve the proper behavior, don't you think?

    I agree with you

     
  • Scott Silliman

    Scott Silliman - 2012-10-17

    ok, I'll submit a patch sometime in the not so distant future, but first I'm going to need to find a machine which is a combination of having pulse installed and not having a broken mic jack :(

     
  • Fern

    Fern - 2013-07-18

    Hello;

    I am having the same issue. Even though I do a ad_stop_rec i keep decoding the audio that have been recorded between the stop and start. How do I know what audio is sphinxbase is using(alsa or pulse). I dowloaded pocketsphinx and sphinxbase via apt-get install. I am runnin on a windows laptop using Ubuntu on VMWare. I have found both headers for pulse and alsa installed on my Ubuntu distribution. Did the patch mentioned above made it to the package? THanks

    Fern

    arecord shows
    default
    Playback/recording through the PulseAudio sound server
    sysdefault:CARD=AudioPCI
    Ensoniq AudioPCI, ES1371 DAC2/ADC
    Default Audio Device
    front:CARD=AudioPCI,DEV=0
    Ensoniq AudioPCI, ES1371 DAC2/ADC
    Front speakers
    surround40:CARD=AudioPCI,DEV=0
    Ensoniq AudioPCI, ES1371 DAC2/ADC
    4.0 Surround output to Front and Rear speakers
    iec958:CARD=AudioPCI,DEV=0
    Ensoniq AudioPCI, ES1371 DAC2/ADC
    IEC958 (S/PDIF) Digital Audio Output
    dmix:CARD=AudioPCI,DEV=0
    Ensoniq AudioPCI, ES1371 DAC2/ADC
    Direct sample mixing device
    dsnoop:CARD=AudioPCI,DEV=0
    Ensoniq AudioPCI, ES1371 DAC2/ADC
    Direct sample snooping device
    hw:CARD=AudioPCI,DEV=0
    Ensoniq AudioPCI, ES1371 DAC2/ADC
    Direct hardware device without any conversions
    plughw:CARD=AudioPCI,DEV=0
    Ensoniq AudioPCI, ES1371 DAC2/ADC
    Hardware device with all software conversions

     

    Last edit: Fern 2013-07-18
  • Fern

    Fern - 2013-07-18

    I added the flush and the data still there after the flush any ideas?

     
  • Fern

    Fern - 2013-07-18

    I believe he flush will not work as it only work for Playback rather than recording which is what we are doing, the pulse API does not offer any other alternatives. How do I switch to ALSA?

    int pa_simple_flush(pa_simple p, int rerror) {
    pa_operation *o = NULL;
    pa_assert(p);
    CHECK_VALIDITY_RETURN_ANY(rerror, p->direction == PA_STREAM_PLAYBACK, PA_ERR_BADSTATE, -1);

    regards

    Fern

     
  • Fern

    Fern - 2013-07-18

    I switched to ALSA but changing the name of the pulse directory temporarily did a configure then a make. The alsa works as I wanted to work. No more speech recorded when not supposed to...

    Talking to myself?

    regards

    Fern

     
  • Nickolay V. Shmyrev

    I switched to ALSA but changing the name of the pulse directory temporarily did a configure then a make. The alsa works as I wanted to work. No more speech recorded when not supposed to...

    You could also build a development version of pocketphinx from subversion trunk, this issue has been fixed there.

    Talking to myself?

    For real-time chat please join #cmusphinx channel on freenode.

     
  • Fern

    Fern - 2013-09-20

    What is the link to where I can find the latest code. What file should I look for for the patch. All links I follow give an empty screen.

    Fern

     
  • Nickolay V. Shmyrev

    What is the link to where I can find the latest code.

    https://sourceforge.net/p/cmusphinx/code/HEAD/tree/trunk/

    What file should I look for for the patch.

    For what patch exactly?

    All links I follow give an empty screen.

    Works here, what link is broken?

     
  • Fern

    Fern - 2013-09-20

    Hello;

    -->For what patch exactly?
    This thread mentions that under pulse ad_stop_rec in ad_pulse.c does not really stop recording. In one of the replies I found the following

    """""

    I switched to ALSA but changing the name of the pulse directory temporarily did a configure then a make. The alsa works as I wanted to work. No more speech recorded when not supposed to...

    You could also build a development version of pocketphinx from subversion trunk, this issue has been fixed there.

    """""

    What patch were you referring to?

    Thank you

    Fern

    By the way the link that I tought was brokes was the one pointing to the latest code from the CMU Wiki site. But now I click it and find everything ok. Not sure what happened before.

     

Log in to post a comment.

MongoDB Logo MongoDB