Menu

pocketsphinx

Help
juju49l
2010-11-03
2012-09-22
1 2 > >> (Page 1 of 2)
  • juju49l

    juju49l - 2010-11-03

    Has someone already use pocketsphinx on c# project?
    I am trying to do it, but it is the first time in speech recognition and it is
    a little bit difficult...
    I have not found any exemple on it!
    Please help lol

     
  • Nickolay V. Shmyrev

    Has someone already use pocketsphinx on c# project?

    Yes

    I am trying to do it, but it is the first time in speech recognition and it
    is a little bit difficult...

    We are here to help you

    I have not found any exemple on it!

    There are things in this world you will not find example. In your daily life
    you can proceed without examples, try to apply this knowledge to software
    development. Sometimes you need to turn on your brain.

    On this particular problem you can find the information on using C library
    from C# here:

    http://blogs.msdn.com/b/jonathanswift/archive/2006/10/02/780637.aspx

    lol

    LOL indeed

     
  • juju49l

    juju49l - 2010-11-04

    Hello and thanks to be there nshmyrev
    My first problem is this one:
    I read those lignes http://cmusphinx.sourceforge.net/wiki/tuturialpocketsphin
    x
    but i am not
    sure in what i had to do...
    I have compile pocketsphinx and sphinxbase, but what did i import in the c#
    project? if i understand i only import .exe and dll is that right?

     
  • Nickolay V. Shmyrev

    Please check updated tutorial page again to learn more about pocketsphinx API

    http://cmusphinx.sourceforge.net/wiki/tuturialpocketsphinx

    if i understand i only import .exe and dll is that right?

    Only dll

     
  • juju49l

    juju49l - 2010-11-04

    So i had to import pocketsphinx.dll and sphinxbase.dll on the project that's
    all?
    I have seen how to use it with and "using System.Runtime.InteropServices;"
    I wil try with the tutorial but for the moment i dont understand how to do...
    i think I lack knowledge to use a such tool

     
  • Nickolay V. Shmyrev

    So i had to import pocketsphinx.dll and sphinxbase.dll on the project that's
    all?
    I have seen how to use it with and "using System.Runtime.InteropServices;"

    Yes, that's the way

    I wil try with the tutorial but for the moment i dont understand how to
    do... i think I lack knowledge to use a such tool

    We would be glad to answer your questions, but you need to ask more specific
    ones.

     
  • juju49l

    juju49l - 2010-11-04

    We would be glad to answer your questions, but you need to ask more specific
    ones.

    Thank fo that and for your patience, i am very glad to work on speech
    recognition but it is new and quiet difficult for mee, i am beginer like
    developer...

    I tried to use a c++ dll and i sucess,she was quiet simple.
    So in the tutorial on part "Code listing", if i understand this code
    transcribe a stream (voice on microphone) and print on screen the recognize
    "text" is that right?

     
  • Nickolay V. Shmyrev

    So in the tutorial on part "Code listing", if i understand this code
    transcribe a stream (voice on microphone) and print on screen the recognize
    "text" is that right?

    Code listing takes audio data from a file, not from a microphone. Yes, it
    outputs recognized text on the screen.

     
  • juju49l

    juju49l - 2010-11-04

    Code listing takes audio data from a file

    Yes it is right sorry... So i just have to "convert" this code to c#! Thanks
    One more question! Is the file format defined or did it works with a .wav
    file?

     
  • juju49l

    juju49l - 2010-11-04

    Do you think it is possible to do it in c++ and after that to launch it wif an
    audio file as parameter by c# application?

     
  • cornelyus

    cornelyus - 2010-11-04

    hello juju49l..

    I think it was you that sent me an e-mail yesterday..

    Regarding that issue, yes i was able to make pocketsphinx run along my c#
    application..

    You have to write a c# wrapper that makes the "bridge" between c++ (unmanaged
    code) and c# ( managed code) .. as you figured out before using ...

    The way i reached some success:
    Open pocketsphinx project, specifically the file continuous.c .. this is the
    example for creating pocketsphinx_continuous .. try to understand what happens
    in "main()" and "utterance loop()" .. so you can develop methods on the
    pocketsphinx dll that can be called from the c# project.

    There was an insteresting project who had some info on this, but the page
    seems it's not working:
    http://users.ece.gatech.edu/~hamblen/489X/S10proj/Universal_Translator/sites.
    google.com/site/utrans10/home.html

    http://www.youtube.com/watch?v=PDUI6iomQYQ
    it was called Universal Translator..

    good luck and keep us posted

     
  • juju49l

    juju49l - 2010-11-04

    I think it was you that sent me an e-mail yesterday..

    Yes corneyus it was me!
    thank you for this answer with all post and doc i have read today i think this
    is the better way but i dont know c++ and i dont think i will have time to
    learn it (that is why i choose c#)... i will try to do it ;).
    That is too bad for Universal Translator...
    Thank for your help guys realy appreciate

     
  • cornelyus

    cornelyus - 2010-11-04

    if you are learning a language.. i would say to be comfortable with it before
    "diving" into the pocketsphinx code.. just my 2 cents..

     
  • juju49l

    juju49l - 2010-11-04

    Complitely agreed but it is not my choice, like i said i do it for a company,
    i am in "apprenticeship" (is it the good word?).
    It was in the spesifications to use sphinx, but sphin is in Java it is
    problematic since i only know c#, that is why i am trying to do it with
    pocketsphinx ... interopertates between c++ and c# is probably easyer than
    java and c#.
    My application is well advanced it lake speech recognition... but i have
    already do the same with SAPI (microsoft), however the company won't be
    dependant on microsoft. That is my story lol

     
  • cornelyus

    cornelyus - 2010-11-05

    Hum... i too am going from SAPI to pocketsphinx to measure results...
    As for java and c#... if you know c#, java is easy to learn...

    it all depends on what final result you are looking for ..

    another link that might help you with pocketsphinx specifically

    http://www.astalavista.com/topic/29952-hack-adding-speech-recognition-to-
    your-embedded-platform/

     
  • nesteaman cocacola

    Hello, I'm trying to use pocketsphinx to make one social robot. I use this
    code and works good:

    #include <pocketsphinx.h>
    #define MODELDIR "/usr/share/pocketsphinx/model"
    
    
    int
    main(int argc, char *argv[])
    {
            ps_decoder_t *ps;
            cmd_ln_t *config;
            FILE *fh;
            char const *hyp, *uttid;
            int16 buf[512];
            int rv;
            int32 score;
    
            config = cmd_ln_init(NULL, ps_args(), TRUE,
                                 "-hmm", MODELDIR "/hmm/en_US/hub4_wsj_sc_3s_8k.cd_semi_5000",
                                 "-lm", MODELDIR "/lm/en/turtle.DMP",
                                 "-dict", MODELDIR "/lm/en/turtle.dic",
                                 NULL);
            if (config == NULL)
                    return 1;
            ps = ps_init(config);
            if (ps == NULL)
                    return 1;
    
            fh = fopen("/home/pablo/pfc/ordenes_de_voz/daironNumbers.wav", "rb");
            if (fh == NULL) {
                    perror("Failed to open daironNumbers.raw");
                    return 1;
            }
    
            rv = ps_decode_raw(ps, fh, "daironNumbers", -1);
            if (rv < 0)
                    return 1;
            hyp = ps_get_hyp(ps, &score, &uttid);
            if (hyp == NULL)
                    return 1;
            printf("Recognized: %s\n", hyp);
    
            fseek(fh, 0, SEEK_SET);
            rv = ps_start_utt(ps, "daironNumbers");
            if (rv < 0)
                    return 1;
            while (!feof(fh)) {
                size_t nsamp;
                nsamp = fread(buf, 2, 512, fh);
                rv = ps_process_raw(ps, buf, nsamp, FALSE, FALSE);
            }
            rv = ps_end_utt(ps);
            if (rv < 0)
                    return 1;
            hyp = ps_get_hyp(ps, &score, &uttid);
            if (hyp == NULL)
                    return 1;
            printf("Recognized: %s\n", hyp);
    
            fclose(fh);
            ps_free(ps);
            return 0;
    }
    

    I want to use the microphone in some moments of my program, and i don't know
    what's are the functions that configure the microphone, open, and translate
    all what i say. I think that i must use that function:

    hyp = ps_get_hyp(ps, &score, &uttid)

    once collect from the micro but I have looked for in the API : http://cmusphi
    nx.sourceforge.net/api/pocketsphinx/

    But i don't found anything.

    Can you help me please?

    Thanks!!

     
  • Swetha Ganesan

    Swetha Ganesan - 2011-03-07

    Hi,

    I am trying to write a C# cover using pocketsphinx.dll.

    Can someone please help me on how I can translate the following functions from
    pocketsphinx :

    SPHINXBASE_EXPORT
    int32 cont_ad_read (cont_ad_t r, /< In: Object pointer returned by
    cont_ad_init
    /
    int16 buf, /< In/Out: In block mode, contains input data.
    On return, buf contains A/D data returned
    by this function, if any.
    /
    int32 max /*< In: Maximum number of samples to be filled into buf.
    NOTE: max must be at least 256; otherwise
    the functions returns -1.
    /
    );

    SPHINXBASE_EXPORT
    cont_ad_t cont_ad_init (ad_rec_t ad, /< In: The A/D source object to be
    filtered /
    int32 (
    adfunc)(ad_rec_t ad, int16 buf, int32 max)
    /
    < In: adfunc = source function to be invoked
    to obtain raw A/D data. See ad.h for the
    required prototype definition. */
    );

    SPHINXBASE_EXPORT
    cont_ad_t cont_ad_init_rawmode (ad_rec_t ad,
    int32 (adfunc)(ad_rec_t ad, int16 *buf, int32 max));

    Thank you so much.:)

     
  • Nickolay V. Shmyrev

    Hello sweththegr8

    I don't think this part of the API is translatable to C#. It doesn't meant to
    be used in bindings. I suggest you to design another API and implement it in
    C#. For example it could look this way

    class SpeechFramesReader() {
            SpeechReader () {
                .. init stuff here
            }
    
            byte[] readNextFrames () {
                   do stuff here using cont_ad.h functions
            }
    }
    
     
  • Amin Yazdani

    Amin Yazdani - 2011-05-12

    Any successful results on building a C# API for pocket sphinx?

    I'm about to start my project on it, and I appreciate if anyone can share a
    successful experience with me.

    Bests,
    Amin

     
  • Anuj Kumar

    Anuj Kumar - 2011-06-02

    Any luck with the C# wrapper for pocketsphinx?

    I'm building a C# application that uses pocketSphinx recognizer. I have built
    the pocketSphinx and sphinxBase solutions in Visual Studio 2010 and obtained
    the pocketSphinx.dll and sphinxbase.dll, which I will import into the C# code
    using the command. My questions are:

    1. As mentioned in the above posts, what is the using "System.Runtime.InteropServices;" command for?
    2. Once you import the dll's, what steps do you have to do to use pocketSphinx_continuous? Would there be some documentation or examples that illustrate that?

    I'm sorry, but simple online searching did not result in any concrete links,
    but I'm sure that this has been done extensively in the past.

    Thanks.

     
  • Amin Yazdani

    Amin Yazdani - 2011-06-02

    Any luck with the C# wrapper for pocketsphinx?

    I build my own wrapper a while ago. It's not that hard.

    1. As mentioned in the above posts, what is the using
      "System.Runtime.InteropServices;" command for?

    DLLImport is part of System.Runtime.InteropServices
    for calling any unmanaged dll, such as pocketsphinx or sphinxbase, you need
    that.

    1. Once you import the dll's, what steps do you have to do to use
      pocketSphinx_continuous? Would there be some documentation or examples that
      illustrate that?

    There is no documentation for that (unfortunately), but the way that i did
    that was building an interface in C (a project like pocketsphinx_continuous)
    where I know what's my input and what output I expect. Then importing that
    into my C# project.
    That way it was easier for me to manage Marshaling in C#, but you can either
    do that or call C functions from your C# project.

     
  • Anuj Kumar

    Anuj Kumar - 2011-06-02

    Thanks, aspersica! Would you mind sharing your C#/C interface that imported
    the pocketSphinx and sphinxBase DLLs and then went on to use them. Having a
    sample would be of great value. Thank you so much.

     
  • Anuj Kumar

    Anuj Kumar - 2011-06-02

    BTW, I realized that pasting a somewhat huge piece of code online might be
    cumbersome, so if you'd prefer, you could email me at: anujkumar9@gmail.com

     
  • Amin Yazdani

    Amin Yazdani - 2011-06-02

    Thanks, aspersica! Would you mind sharing your C#/C interface that imported
    the pocketSphinx and sphinxBase DLLs and then went on to use them. Having a
    sample would be of great value. Thank you so much.

    Sorry, that code is now part of a product, so I can't distribute that code.
    But it's easy. You won't have problem writing that yourself, and you always
    can ask question here.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.