In my PocketSphinxDemo activity the following bit of the code is what seems to
be making my demo stop almost straight after it starts with a message saying
"Unfortunately PocketSphinxDemo has stopped" coming up on the tablet.
static {
try{
System.loadLibrary("pocketsphinx_jni");
Log.e("JNI", "CONGRATULATIONS: Loaded library successfully!");
}catch(UnsatisfiedLinkError use){
Log.e("JNI", "WARNING: Could not load libpocketsphinx_jni.so");
}
}
I understand that its looking for the library libpocketsphinx_jni.so but the
path that its looking at is
/data/data/edu/cmu/pocketsphinx/demo/lib/libpocketsphix_jni.so
However, when I went and looked inside the PocketSphinxDemo.apk the
library(libpocketsphinx_jni.so) is actually located in the libs folder inside
the apk, not in the
/data/data/edu/cmu/pocketsphinx/demo/lib/libpocketsphix_jni.so.
So I tried to change the path it looks at for the library to,
/data/data/lib/libpocketsphix_jni.so but that doesn't seem to make any
difference either.
My question is, how can I redirect it to that lib folder that is inside the
apk in order to find the library?
Please let me know if any more clarification is needed.
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there. /data/data/edu/cmu/pocketsphinx/demo/lib/libpocketsphix_jni.so - is
a path on your phone after apk will be installed. don't take care of that. If
you built pocketsphinx with NDK correctly it will be automatically located
there. Be more careful at the build part. Are you shure you compiled your code
without errors? Also take a look on builders screen. check if you feel the
required fields correctly and put flags in checkboxes near NDK and SWIG. Hope
this helps.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just wanted to ascertain that the libpocketsphinx_jni.so file was actually
there and it is. However, I still get the message saying that it can't be
loaded.
However, the point that you mention about taking care during the building part
is an interesting one as I noticed that when the application is doing the NDK
build, 2 warnings pop up in red (I am using Eclipse btw). The problem though
is that before I can see what the error is, the console switched to the one
where it show the deployment progress of PocketSphinxDemo.apk.
Have you got any suggestions about that?
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for the late reply. I configured them as per the paragraph that you
pasted from the tutorial thats why I cant seem to figure out what is going
wrong.
You are missing libpocketsphinx_jni.so in the /libs/armeabi. You haven't
compiled sources with ndk in a right way. You need to do all the tutorial from
the very beginning and to change 162 line of Android.mk. There should be
The following screenshot shows that the lib does exist in that folder. I went
and looked for it straight after I saw your post so I did not build the
project or do anything like that:
[url]http://tinypic.com/r/2vblk6x/6[/url]
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No. you need to redo everything with changing Android.mk I suggested. It's
working OK. You just need to be accurate.
1) download Pocketsphinx demo
2) change Android,mk lines 162 and 5
3) build c-source with ndk
4) change builders setting in eclipse
5) push models on the cell.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did everything that you said in those 5 steps above and then carefully did
the last part of the tutorial about changing some of the hardcoded paths in
the RecognizerTask.java.
Thats when I realized that I missed out on that part the first time round
because it just looks so similar to whats in the code:
There are declared paths to a structure that is not valid on a 2.2 phone. We will need to change the paths so that they work correctly. Here is my code for the section.
pocketsphinx.setLogfile("/mnt/sdcard/edu.cmu.pocketsphinx/pocketsphinx.log");
Config c = new Config();
/*
* In 2.2 and above we can use getExternalFilesDir() or whatever it's called*/
c.setString("-hmm", "/mnt/sdcard/edu.cmu.pocketsphinx/hmm/en_US/hub4wsj_sc_8k");
c.setString("-dict", "/mnt/sdcard/edu.cmu.pocketsphinx/lm/en_US/hub4.5000.dic");
c.setString("-lm", "/mnt/sdcard/edu.cmu.pocketsphinx/lm/en_US/hub4.5000.DMP");
c.setString("-rawlogdir", "/mnt/sdcard/edu.cmu.pocketsphinx"); // Only use it to store the audio
If your model is different, you will have to use different paths, for example fo rthe mandarin model
c.setString("-hmm", "/sdcard/Android/data/edu.cmu.pocketsphinx/hmm/zh/tdt_sc_8k");
c.setString("-dict", "/sdcard/Android/data/edu.cmu.pocketsphinx/lm/zh_TW/mandarin_notone.dic");
c.setString("-lm", "/sdcard/Android/data/edu.cmu.pocketsphinx/lm/zh_TW/gigatdt.5000.DMP");
The part above changes the hardcoded paths in the code that used to work well
till Android 2.2, in order to make them work for the later versions.
That was what I overlooked due to which my model and all the other things were
in the wrong place.
Thank you so much for your help!
However, I noticed that in the models folder, there are 2 other folder, en and
zh. Are those folders for different languages?
I used the PocketSphinxDemo and found that it was extremely inaccurate for
me(probably since I have a slight Kiwi accent). Do you reckon that using the
en model might work better?
Also is there any documentation on how I can create my own english language
model but with only like 50 or so words?
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
In my PocketSphinxDemo activity the following bit of the code is what seems to
be making my demo stop almost straight after it starts with a message saying
"Unfortunately PocketSphinxDemo has stopped" coming up on the tablet.
static {
try{
System.loadLibrary("pocketsphinx_jni");
Log.e("JNI", "CONGRATULATIONS: Loaded library successfully!");
}catch(UnsatisfiedLinkError use){
Log.e("JNI", "WARNING: Could not load libpocketsphinx_jni.so");
}
}
I understand that its looking for the library libpocketsphinx_jni.so but the
path that its looking at is
/data/data/edu/cmu/pocketsphinx/demo/lib/libpocketsphix_jni.so
However, when I went and looked inside the PocketSphinxDemo.apk the
library(libpocketsphinx_jni.so) is actually located in the libs folder inside
the apk, not in the
/data/data/edu/cmu/pocketsphinx/demo/lib/libpocketsphix_jni.so.
So I tried to change the path it looks at for the library to,
/data/data/lib/libpocketsphix_jni.so but that doesn't seem to make any
difference either.
My question is, how can I redirect it to that lib folder that is inside the
apk in order to find the library?
Please let me know if any more clarification is needed.
Cheers
Hi there. /data/data/edu/cmu/pocketsphinx/demo/lib/libpocketsphix_jni.so - is
a path on your phone after apk will be installed. don't take care of that. If
you built pocketsphinx with NDK correctly it will be automatically located
there. Be more careful at the build part. Are you shure you compiled your code
without errors? Also take a look on builders screen. check if you feel the
required fields correctly and put flags in checkboxes near NDK and SWIG. Hope
this helps.
Hi Bic-User,
I just wanted to ascertain that the libpocketsphinx_jni.so file was actually
there and it is. However, I still get the message saying that it can't be
loaded.
However, the point that you mention about taking care during the building part
is an interesting one as I noticed that when the application is doing the NDK
build, 2 warnings pop up in red (I am using Eclipse btw). The problem though
is that before I can see what the error is, the console switched to the one
where it show the deployment progress of PocketSphinxDemo.apk.
Have you got any suggestions about that?
Cheers
no. I mean build progress from terminal after the-path-to-your-ndk-folder/ndk-
build -B you are using this tutorial:
http://cmusphinx.sourceforge.net/2011/05/building-pocketsphinx-on-
android/ ???
Oh I see what you mean. Well i did the ndk-build again and got the following
output:
The only out of place thing I can spot is the warning on top.. but even that
doesn't make too much sense to me.
yeah. seems to be ok. Are you sure you configured SWIG and NDK build
properly?? did you put checks near them? Try to make this part again:
if that doesn't help, upload please your project...
Sorry for the late reply. I configured them as per the paragraph that you
pasted from the tutorial thats why I cant seem to figure out what is going
wrong.
How and what checks can I put near them?
Here is a link to my compressed project:
Its a 3.2 mb tar.gz file which when uncompressed is around 10.3 mb in size.
Please have a look and let me know what I can do to get this deom up and
running.
Cheers!
You are missing libpocketsphinx_jni.so in the /libs/armeabi. You haven't
compiled sources with ndk in a right way. You need to do all the tutorial from
the very beginning and to change 162 line of Android.mk. There should be
over there.
Hi Bic-user
libpocketsphinx_jni.so is present in the libs/armeabi directory in the
PocketSphinxDemo folder.
However, the order of the static libraries was different so I have changed it
to make it look like what you have got there.
I just zipped up my demo folder and sent it to you so are you sure that
PocketSphinxDemo/libs/armeabi/libpocketsphinx_jni.so doesnt exist?
Cheers
The following screenshot shows that the lib does exist in that folder. I went
and looked for it straight after I saw your post so I did not build the
project or do anything like that:
I just changed the Android.mk file as you suggested and on running the demo
again, got the same problem.
I will try to re do the whole thing and get back to you but I doubt I will get
a different result.
In the mean time, let me know if you come up with anything else.
Cheers
No. you need to redo everything with changing Android.mk I suggested. It's
working OK. You just need to be accurate.
1) download Pocketsphinx demo
2) change Android,mk lines 162 and 5
3) build c-source with ndk
4) change builders setting in eclipse
5) push models on the cell.
Thank you so much bic-user! You are a life saver.
I did everything that you said in those 5 steps above and then carefully did
the last part of the tutorial about changing some of the hardcoded paths in
the RecognizerTask.java.
Thats when I realized that I missed out on that part the first time round
because it just looks so similar to whats in the code:
The part above changes the hardcoded paths in the code that used to work well
till Android 2.2, in order to make them work for the later versions.
That was what I overlooked due to which my model and all the other things were
in the wrong place.
Thank you so much for your help!
However, I noticed that in the models folder, there are 2 other folder, en and
zh. Are those folders for different languages?
I used the PocketSphinxDemo and found that it was extremely inaccurate for
me(probably since I have a slight Kiwi accent). Do you reckon that using the
en model might work better?
Also is there any documentation on how I can create my own english language
model but with only like 50 or so words?
Cheers
Don't ask. try. it depends.
http://cmusphinx.sourceforge.net/wiki/tutoriallm. But you better should learn whole wiki.
For new question start new thread.
Sorry. en is for digits. Anyway you can find other models on the project site.
Thanks! Really appreciate it mate.