I downloaded the library files (.dll
) to make PocketSphinx work for Windows desktop. From the command prompt it is working. I want to use these dlls in a Java application so that I can create a .jar
and use it as a whole.
Asked
Active
Viewed 400 times
2

helencrump
- 1,351
- 1
- 18
- 27

suidj Gupta
- 25
- 7
1 Answers
1
You can not use pocketsphinx.dll in java. You have to compile JNI extension in a special way as explained in:
Getting Started with JNI and C under Windows
pocketsphinx already supports SWIG, so you can create the wrapper automatically from pocketsphinx.i
interface description. However, you need to compile everything into dll file after that yourself. You can collect sources and just write another makefile.

Community
- 1
- 1

Nikolay Shmyrev
- 24,897
- 5
- 43
- 87
-
1Thanks for your reply **Nikolay**. I am able to create wrapper. But my question was how to create a `.jar` out of it. – suidj Gupta Jan 18 '16 at 09:52
-
I am able to regenerate .dll after adding c wrapper files. but when i am loading those .dll then getting following error. Exception in thread "main" java.lang.UnsatisfiedLinkError: E:\Workspace\Desktop\TestPocketSphinx\lib\pocketsphinx_jni.dll:*The specified procedure could not be found* at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0 at java.lang.ClassLoader.loadLibrary at java.lang.Runtime.loadLibrary0 at java.lang.System.loadLibrary at test.DecoderTest.
(DecoderTest.java:26) – suidj Gupta Jan 22 '16 at 11:56 -
It is hard to help, you can provide the whole test package in archive. Upload it somewhere (dropbox for example) and give here a link. – Nikolay Shmyrev Jan 22 '16 at 18:24
-
Library is up and working. But now I am stuck at some other place. If we execute pocketsphinx_continuous.exe from command line we have to use **-inmic** attribute to use microphone. How Can achieve same thing by using java?? – suidj Gupta Jan 27 '16 at 09:00
-
You record audio from java as data (Microphone class on javax.sound API) and pass it to the recognizer. – Nikolay Shmyrev Jan 27 '16 at 14:08
-
I am able to run DecoderTest.java perfectly. But i want to achieve same thing with microphone means my microphone is continuously recording and i am sending the audioInputStream data to **decoder.processRaw** before even stopping microphone. I tried this but somehow. .dll library is not returning any logs and **decoder.hyp()** is also coming as null. continuously. I think that recorder thread is messing with the decoder library thread. in C library – suidj Gupta Jan 28 '16 at 04:48
-
Unlikely. It is the issue with your java code. In case you want help on this you can post another question and provide all code you have. – Nikolay Shmyrev Jan 28 '16 at 09:02
-
please review this [link]http://stackoverflow.com/questions/35084097/continous-keyphrase-detection-in-pocketsphinx-for-windows-desktop-using-java – suidj Gupta Jan 29 '16 at 12:03