Sorry, I already figured out the bottom line here is
I have to add the command below
recognizer = defaultSetup()
.setAcousticModel(new File(assetsDir, "de-cont"))
.setDictionary(new File(assetsDir, "voxforge.dic"))
// To disable logging of raw audio comment out this call (takes a lot of space on the device)
.setRawLogDir(assetsDir)
// Threshold to tune for keyphrase to balance between false alarms and misses
.setKeywordThreshold(1e-45f)
// Use context-independent phonetic search, context-dependent is too slow for mobile
.setBoolean("-allphone_ci", true)
.getRecognizer();
recognizer.addListener(this);
Last edit: Toan Nguyen 2016-03-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Dear cmusphinx,
I noticed that the tool pocketsphinx_batch from pocketsphinx can recognize
the speech via wav file.
Could you please tell me how to use this tool in android os or write some
source code to implement exactly like it does.
Yours sincerely, Toan
The code to recognize file on Android is outlined here:
http://stackoverflow.com/questions/29008111/give-a-file-as-input-to-pocketsphinx-on-android
Also here
https://sourceforge.net/p/cmusphinx/discussion/help/thread/e8ea1585/?limit=25#9501/528d
@Mr. Nickolay V. Shmyrev
I already tried your solution. But my app gets crashed at the command line below
Config c = Decoder.defaultConfig();
Please tell me how to fix it.
I'm not sure what do you mean by "crashed", you need to provide more details.
It means my android app is forced close instantly as soon as running the command above
Last edit: Toan Nguyen 2016-03-29
It must print something in logcat, you should check it out first of all.
The attachment file is the log error
I am using the source code from github
https://github.com/cmusphinx/pocketsphinx-android-demo
Last edit: Toan Nguyen 2016-03-30
And, did you try to think on this error? Did you try to google for it? This error is very easy to solve if you turn on your brains for a second.
I already added jni so file to your project properly but it does not work
Last edit: Toan Nguyen 2016-03-30
Could you please try to run your sample code like you suggest to check whether it works or not
No you did not load the JNI library, this is what your log says.
It works fine
Sorry, I already figured out the bottom line here is
I have to add the command below
Last edit: Toan Nguyen 2016-03-30
Before the command line
Config c = Decoder.defaultConfig();
And It works