Menu

Pocketsphinx lib dies under JNI for Android

Help
2010-08-29
2012-09-22
  • Karl OGrady

    Karl OGrady - 2010-08-29

    Using the sample JNI Code under swig folder of pocketsphinx, I am able to load
    the library in Android Java SDK with System.LoadLibrary("pocketsphinx_jni"). I
    can then successfully create a Config object and Decoder object.
    I have:
    Config c = new Config();
    c.setString("-hmm", pathToHMMFolder);
    c.setString("-lm", pathToLM);
    c.setString("-dic", pathToDic);
    Decoder d = new Decoder(c);

    As soon as I call
    d.startUtt();
    the application dies. The DDMS debugger under Eclipse states: process
    edu.cmu.pocketsphinx (pid 313) has died.

     
  • Nickolay V. Shmyrev

    Sorry, this is highly experimental code, you need to try to debug it yourself,
    try to add printfs down the stack to see how far it goes.

    But I highly suspect that the issue is that you are using "-dic" instead of
    "-dict".

     
  • Karl OGrady

    Karl OGrady - 2010-09-01

    Thanks for responding. I had noticed that -dict problem alright but the
    problem seems to be memory related. I increased the Android emulator RAM to
    512Mb, heap size for Dalvik to 64 and cache partition to 64Mb and got
    startUtt(), endUtt() to complete without crashing. Now I am trying to do this
    and getting the process dying once again. More memory needed maybe? The sample
    experimental code uses an AudioStream to open the wav file from the
    javax.sound library. However I'm using RandomAccessFile since the
    javax.sound
    library isn't included in the anroid SDK anymore

    fWriter = new RandomAccessFile(pathToWav, "r");
             d.startUtt();
             /*byte[] b = new byte [512];
             int nbytes;
             while ((nbytes = fWriter.read(b)) >=0 ){
              ByteBuffer bb = ByteBuffer.wrap(b, 0, nbytes);
              short[] s = new short[nbytes/2];
              bb.asShortBuffer().get(s);
              //d.processRaw(s, false, false);
              //tv.append( d.getHyp().getHypstr() + ":");
             }*/
             d.endUtt();
    
     
  • Nickolay V. Shmyrev

    Well, recognizer shoudn't really take so much memory. 100mb is definitely
    enough unless something goes wrong with SWIG

    You can probably try more lightweight tidigits model to test recognition
    first.

     

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.