Menu

SphinxTrain snapshot help

Help
lag
2012-04-04
2012-09-22
  • lag

    lag - 2012-04-04

    Hi, to not add a topic for every question I think it's better to ask all what
    I need just here

    I'm using SphinxTrain snapshot and when I run "sphinxtrain -t test setup" it
    just add the feat.params and sphinx_train.cfg in the etc folder, there is no
    other folders (feat logdir model_parameters model_architecture...) just etc
    and wav that I've creat before

    and inside of sphinx_train.cfg I've this:

    # Variables used in characterizing models
    
    $CFG_HMM_TYPE = '.cont.'; # Sphinx III
    #$CFG_HMM_TYPE  = '.semi.'; # PocketSphinx and Sphinx II
    #$CFG_HMM_TYPE  = '.ptm.'; # PocketSphinx (larger data sets)
    

    but in the tutorial:

    $CFG_HMM_TYPE = '.cont.'; # Sphinx 4, Pocketsphinx
    #$CFG_HMM_TYPE  = '.semi.'; # PocketSphinx
    #$CFG_HMM_TYPE  = '.ptm.'; # PocketSphinx (larger data sets)
    

    and I just wanna make sure I did the right thing with the .lm.DMP, I did what
    in the language model tuto

    sphinx_lm_convert -i model.lm -o model.dmp
    sphinx_lm_convert -i model.dmp -ifmt dmp -o model.lm -ofmt arpa
    

    , after that I renamed the .dmp to .lm.DMP, am I right?!

    last question: I based my work on the an4 folder, I did the same
    wav/amdigits_clstk and wav/amdigitstest_clstk for the test, my suestion is the
    test data should I use some data from the amdigits_clstk or something else...

    Thank you so much for all the help

     
  • lag

    lag - 2012-04-04

    Is there anybody here??!!!

    I want to build an application with pocketsphinx, can I use code::blocks and
    Qt to creat an interface?

    and what I've to import from sphinxbase and pocketsphinx, can you please
    explain, I'm totaly lost :s

     
  • Nickolay V. Shmyrev

    but in the tutorial: $CFG_HMM_TYPE = '.cont.'; # Sphinx 4, Pocketsphinx

    This documentation difference was fixed in trunk

    and I just wanna make sure I did the right thing with the .lm.DMP, I did
    what in the language model tuto sphinx_lm_convert -i model.lm -o model.dmp
    sphinx_lm_convert -i model.dmp -ifmt dmp -o model.lm -ofmt arpa, after that I
    renamed the .dmp to .lm.DMP, am I right?!

    Only first command is enough. Second command is needed to convert model back.

    There was no need to rename extension to uppercase

    last question: I based my work on the an4 folder, I did the same
    wav/amdigits_clstk and wav/amdigitstest_clstk for the test, my suestion is the
    test data should I use some data from the amdigits_clstk or something else...

    For the test data you need to use recordings closer to the audio you are going
    to recognize, not an4.

    I want to build an application with pocketsphinx, can I use code::blocks and
    Qt to creat an interface?

    Yes you can

    and what I've to import from sphinxbase and pocketsphinx, can you please
    explain, I'm totaly lost :s

    See http://forums.codeblocks.org/index.php?topic=9672.0

    http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:My
    project_should_be_compiled_with_a_custom_makefile._Is_it_possible_with_Code::B
    locks.3F

     
  • lag

    lag - 2012-04-08

    Thank you much sir :) :) :)

    Yes I know how to import .h/c/cpp files to my project, but I just don't know
    the right ones to import, can you please tell me the right one to import in
    order to build a cpp application with a simple qt interface, that records
    voice from mic and compare it with my acoustic model... May be using this
    function:

    static void
    recognize_from_microphone()
    {
        ad_rec_t *ad;
        int16 adbuf[4096];
        int32 k, ts, rem;
        char const *hyp;
        char const *uttid;
        cont_ad_t *cont;
        char word[256];
    
        if ((ad = ad_open_dev(cmd_ln_str_r(config, "-adcdev"),
                              (int)cmd_ln_float32_r(config, "-samprate"))) == NULL)
            E_FATAL("Failed top open audio device\n");
    
        /* Initialize continuous listening module */
        if ((cont = cont_ad_init(ad, ad_read)) == NULL)
            E_FATAL("Failed to initialize voice activity detection\n");
        if (ad_start_rec(ad) < 0)
            E_FATAL("Failed to start recording\n");
        if (cont_ad_calib(cont) < 0)
            E_FATAL("Failed to calibrate voice activity detection\n");
    
        for (;;) {
            /* Indicate listening for next utterance */
            printf("READY....\n");
            fflush(stdout);
            fflush(stderr);
    
            /* Wait data for next utterance */
            while ((k = cont_ad_read(cont, adbuf, 4096)) == 0)
                sleep_msec(100);
    
            if (k < 0)
                E_FATAL("Failed to read audio\n");
    
            /*
             * Non-zero amount of data received; start recognition of new utterance.
             * NULL argument to uttproc_begin_utt => automatic generation of utterance-id.
             */
            if (ps_start_utt(ps, NULL) < 0)
                E_FATAL("Failed to start utterance\n");
            ps_process_raw(ps, adbuf, k, FALSE, FALSE);
            printf("Listening...\n");
            fflush(stdout);
    
            /* Note timestamp for this first block of data */
            ts = cont->read_ts;
    
            /* Decode utterance until end (marked by a "long" silence, >1sec) */
            for (;;) {
                /* Read non-silence audio data, if any, from continuous listening module */
                if ((k = cont_ad_read(cont, adbuf, 4096)) < 0)
                    E_FATAL("Failed to read audio\n");
                if (k == 0) {
                    /*
                     * No speech data available; check current timestamp with most recent
                     * speech to see if more than 1 sec elapsed.  If so, end of utterance.
                     */
                    if ((cont->read_ts - ts) > DEFAULT_SAMPLES_PER_SEC)
                        break;
                }
                else {
                    /* New speech data received; note current timestamp */
                    ts = cont->read_ts;
                }
    
                /*
                 * Decode whatever data was read above.
                 */
                rem = ps_process_raw(ps, adbuf, k, FALSE, FALSE);
    
                /* If no work to be done, sleep a bit */
                if ((rem == 0) && (k == 0))
                    sleep_msec(20);
            }
    
            /*
             * Utterance ended; flush any accumulated, unprocessed A/D data and stop
             * listening until current utterance completely decoded
             */
            ad_stop_rec(ad);
            while (ad_read(ad, adbuf, 4096) >= 0);
            cont_ad_reset(cont);
    
            printf("Stopped listening, please wait...\n");
            fflush(stdout);
            /* Finish decoding, obtain and print result */
            ps_end_utt(ps);
            hyp = ps_get_hyp(ps, NULL, &uttid);
            printf("%s: %s\n", uttid, hyp);
            fflush(stdout);
    
            /* Exit if the first word spoken was GOODBYE */
            if (hyp) {
                sscanf(hyp, "%s", word);
                if (strcmp(word, "goodbye") == 0)
                    break;
            }
    
            /* Resume A/D recording for next utterance */
            if (ad_start_rec(ad) < 0)
                E_FATAL("Failed to start recording\n");
        }
    
        cont_ad_close(cont);
        ad_close(ad);
    }
    

    with:

    ....
    config = cmd_ln_init(NULL, ps_args(), TRUE,
                     "-hmm", MODELDIR "/hmm/en_US/hub4wsj_sc_8k",
                     "-lm", MODELDIR "/lm/en/turtle.DMP",
                     "-dict", MODELDIR "/lm/en/turtle.dic",
                     NULL);
    

    Thank's again :)

     
  • lag

    lag - 2012-04-08

    Sorry I think I didn't make myself clear, I just want to add this part :

    config = cmd_ln_init(NULL, ps_args(), TRUE, "-hmm", MODELDIR "/hmm/en_US/hub4wsj_sc_8k", "-lm", MODELDIR "/lm/en/turtle.DMP", "-dict", MODELDIR "/lm/en/turtle.dic", NULL);
    

    to the pocketsphinx/src/programs/continuous.c, I think there is a function
    that allows puting c code in a cpp project ( extern "C" {} I think)

    I just need a point to start from, I'm lost right now :/

    Sorry

     
  • lag

    lag - 2012-04-08

    Hello all,
    I did exactely as You said:

    " Only first command is enough. Second command is needed to convert model
    back. There was no need to rename extension to uppercase

    but now I've some errors :/ :

    ERROR: "ngram_model_arpa.c", line 466: File /home/hyt-med/Desktop/beta/etc/beta.lm.DMP not found
    ERROR: "ngram_model_dmp.c", line 106: Dump file /home/hyt-med/Desktop/beta/etc/beta.lm.DMP not found
    ERROR: "ngram_search.c", line 208: Failed to read language model file: /home/hyt-med/Desktop/beta/etc/beta.lm.DMP
    

    the command sphinx_lm_convert generate a .dmp file but in the tutorial
    :(your_db.lm.DMP), I think I've to rename the file from beta.dmp to
    beta.lm.DMP so it can be found, Yes?!

     

Log in to post a comment.