Menu

Android sphinx wav file

Help
2016-03-16
2016-03-17
  • Kwak Kyuong jin

    Kwak Kyuong jin - 2016-03-16

    I'm sorry about what I wrote a Google Translator . I can not speak English well.
    I am using sphinx for android. Within the App converts the results to a record wav files. With the sphinx want to give a voice to change the sentence . But it was more than awesome . Attach the part of the source code. I saw where the source code was reconstructed some import . Initially I tried to recognize only numbers that fly in aereo decoder. I can not fix this . Help me...

    source code

    private void SpeechtoText(byte[] data) throws IOException {
            Log.d("sonowizLog","inSpeechtoText");
            short[] shortArr = new short[data.length/2];
            for (int i = 0; i <data.length/2 ; i++) {
                shortArr[i] = ( (short)( ( data[i*2] & 0xff )|( data[i*2 + 1] << 8 ) ) );
            }
    
            Assets assets = new Assets(Study_Result.this);
            File assetDir = assets.syncAssets();
    
            Config config = defaultConfig();
            config.setFloat("-samprate", 160000);
            config.setString("-digit", new File(assetDir, "digits.gram").toString());
    
            decoder = new Decoder(config);
            //CRASHES RIGHT HERE ON THE .startUtt(null) COMMAND
            decoder.startUtt();
            decoder.processRaw(shortArr, shortArr.length, false, false);
    
            decoder.endUtt();
            //Display Results
    
        }
    

    logcat

      03-16 18:37:08.829 15430-16403/com.example.choe.prototype W/dalvikvm: No implementation found for native Ledu/cmu/pocketsphinx/PocketSphinxJNI;.Decoder_defaultConfig ()J
    03-16 18:37:08.829 15430-16403/com.example.choe.prototype W/dalvikvm: threadid=19: thread exiting with uncaught exception (group=0x40a79228)
    03-16 18:37:08.829 15430-16403/com.example.choe.prototype E/AndroidRuntime_2_crash: crash in the same process: Thread-1861
                                                                                        java.lang.UnsatisfiedLinkError: Decoder_defaultConfig
                                                                                            at edu.cmu.pocketsphinx.PocketSphinxJNI.Decoder_defaultConfig(Native Method)
                                                                                            at edu.cmu.pocketsphinx.Decoder.defaultConfig(Decoder.java:77)
                                                                                            at com.example.choe.prototype.Study.Study_Result.SpeechtoText(Study_Result.java:278)
                                                                                            at com.example.choe.prototype.Study.Study_Result.access$000(Study_Result.java:42)
                                                                                            at com.example.choe.prototype.Study.Study_Result$1.run(Study_Result.java:119)
    03-16 18:37:08.879 15430-15430/com.example.choe.prototype W/Performance: More than 300ms to handle Handler (android.app.ActivityThread$H) {40d69c88} null: 126, 327ms, start=15080204
    03-16 18:37:08.879 15430-15430/com.example.choe.prototype V/Performance: >>com.example.choe.prototype.Study.Study_Result@40dffe58 performPause
    03-16 18:37:08.879 15430-15430/com.example.choe.prototype V/Performance: <<com.example.choe.prototype.Study.Study_Result@40dffe58 performPause, 0ms
    
     

    Last edit: Nickolay V. Shmyrev 2016-03-16
    • Nickolay V. Shmyrev

      Looks like you didn't add jni so file to your project properly, you need to describe your project layout better.

       
      • Kwak Kyuong jin

        Kwak Kyuong jin - 2016-03-17

        It was added to the jni. I do not know if I can add. There is a jar file. With this added library.

         
        • Nickolay V. Shmyrev

          I'm sorry, it is hard to understand you, at least spend some time on a question.

           

Log in to post a comment.