Menu

PocketSphinx seg fault and core dump

Help
2015-06-16
2015-06-16
  • Michael Stanford

    Hello,

    I put a printf in line 262 of continuous.c of the pre-alpha pocketsphinx release. It's in the read from microphone function--the particular lines are:

    if (!in_speech && utt_started) {
    / speech -> silence transition, time to start new utterance /
    ps_end_utt(ps);
    hyp = ps_get_hyp(ps, NULL );
    if (hyp != NULL)
    printf("Michael heard you\n");
    printf("%s\n", hyp);

    This is the only code modification that I've made so far; this was just to test whether I had identified the correct loop (I have). The problem arises when I attempt to use the-keyphrase flag while running the program. If the program detects the keyphrase from the microphone utterance, everything works as expected. If the program does not detect the keyphrase, then I get a seg fault and the program dumps the core.

    The output of the error looks like this:

    READY....
    Listening...
    INFO: cmn_prior.c(131): cmn_prior_update: from < 40.00 3.00 -1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 >
    INFO: cmn_prior.c(149): cmn_prior_update: to < 54.74 11.38 -2.61 13.58 -1.17 -8.97 -2.80 -2.43 -2.71 3.43 -9.12 -2.22 -6.12 >
    Michael heard you
    make make
    READY....
    Listening...
    INFO: cmn_prior.c(131): cmn_prior_update: from < 54.74 11.38 -2.61 13.58 -1.17 -8.97 -2.80 -2.43 -2.71 3.43 -9.12 -2.22 -6.12 >
    INFO: cmn_prior.c(149): cmn_prior_update: to < 55.33 16.74 -3.45 10.24 -1.94 -8.22 0.04 -2.36 -5.63 -3.66 -11.12 1.57 -5.44 >
    Segmentation fault (core dumped)

    The command line input I used to get this was:
    pocketsphinx_continuous -inmic yes -keyphrase make

    All settings are default and the OS distribution is Ubuntu 14.04 LS.

    Any idea what might be causing this?

    An aside: There's a timing loop on line 269 of continuous.c that sleeps for 100ms:

      if (ps_start_utt(ps) < 0)
                E_FATAL("Failed to start utterance\n");
            utt_started = FALSE;
            printf("READY....\n");
        }
        sleep_msec(100);
    }
    ad_close(ad);
    

    What is that sleep timer doing? It doesn't fit cleanly with either 16000 sampling or 8000 sampling if the buffer is 2048.

    Thank you!

     
    • Nickolay V. Shmyrev

      You need to use brackets most likely:

      if (hyp != NULL) {
          printf("Michael heard you\n");
          printf("%s\n", hyp);
      }
      

      Otherwise it proceeds even when hypothesis is NULL

      What is that sleep timer doing? It doesn't fit cleanly with either 16000 sampling or 8000 sampling if the buffer is 2048.

      It is not really needed. An artifact from the old times.

       
  • Michael Stanford

    That did seem to fix it, thank you!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.