Offline voice recognition

A while ago we got Voce to work entirely on the pc. But after testing it on android I sadly enough get the following error.

I/System.out(17999): [Voce] Initializing recognizer. This may take some time…
E/dalvikvm(17999): Could not find class ‘edu.cmu.sphinx.util.props.ConfigurationManager’, referenced from method voce.SpeechRecognizer.
W/dalvikvm(17999): VFY: unable to resolve new-instance 1829 (Ledu/cmu/sphinx/util/props/ConfigurationManager;) in Lvoce/SpeechRecognizer;
D/dalvikvm(17999): VFY: replacing opcode 0x22 at 0x0012
W/dalvikvm(17999): VFY: unable to resolve exception class 1830 (Ledu/cmu/sphinx/util/props/PropertyException;)
W/dalvikvm(17999): VFY: unable to find exception handler at addr 0x67
W/dalvikvm(17999): VFY: rejected Lvoce/SpeechRecognizer;. (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
W/dalvikvm(17999): VFY: rejecting opcode 0x0d at 0x0067
W/dalvikvm(17999): VFY: rejected Lvoce/SpeechRecognizer;. (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
W/dalvikvm(17999): Verifier rejected class Lvoce/SpeechRecognizer;
W/dalvikvm(17999): threadid=14: thread exiting with uncaught exception (group=0x4132a930)
E/AndroidRuntime(17999): FATAL EXCEPTION: Thread-4467
E/AndroidRuntime(17999): java.lang.VerifyError: voce/SpeechRecognizer
E/AndroidRuntime(17999): at voce.SpeechInterface.init(SpeechInterface.java:79)
E/AndroidRuntime(17999): at nl.hro.gdd.magiaincantamenta.Main$1.run(Main.java:117)
E/AndroidRuntime(17999): at java.lang.Thread.run(Thread.java:856)

Can anyone help with solving this issue by any chance?

Do you use the SDK deployment option to go to android? It looks like its missing half of the classes from the jar files. Also you should really use my adapted version from the update center, this wrapper uses java.io.Files which certainly also leads to issues on android.

I am using the SDK feature to deploy to android indeed. And I am using the version that is in the plugin option of JME

And that some parts are missing I can partly understand. If I dont exclude sphinx4.jar in the "mobile-impl.xml I get an error of double imports when compiling to android.

The way I add the library is by right clicking libraries->add library->Voce Speech Recognition.

oO why double library entries? Did you try to add it to the android project as well? Did you try to clean&build at some point?

I use the clean and build function each time I build.

if I only add it to android project I end up with these errors during compiling:

Compiling 2 source files to C:\Users\Kanda\Documents\JME\Latest\mobile\bin\classes
MainActivity.java:178: error: package voce does not exist
String gramURL = voce.SpeechInterface.class.getResource("/gram/digits.gram").toExternalForm().replaceAll("/digits\.gram", “”);
MainActivity.java:179: error: package voce does not exist
String configURL = voce.SpeechInterface.class.getResource("/voce.config.xml").toExternalForm();

But thats a missing library and not a double one? Is this with your removal change applied?

I removed it from the normal project and added it to android alone.

Android alone:
[java]MainActivity.java:178: error: package voce does not exist
String gramURL = voce.SpeechInterface.class.getResource(“/gram/digits.gram”).toExternalForm().replaceAll(“/digits\.gram”, “”);
MainActivity.java:179: error: package voce does not exist
String configURL = voce.SpeechInterface.class.getResource(“/voce.config.xml”).toExternalForm();[/java]

Project alone (copies the library to mobile/libs):
[java]UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/sun/speech/engine/BaseAudioManager;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
at com.android.dx.command.dexer.Main.processClass(Main.java:486)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:418)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
at com.android.dx.command.dexer.Main.run(Main.java:206)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)[/java]

Strange, guess voce then collides with some android libs.

I have native speech recognition working nicely with JME3 on OS X. I am using the embedded SREC recognizer (part of Android that seemingly no one knows about) – it is open source but only has a US English language model.

How does it compare to Voce? Hard to say in that I do not see documentation of what goes into the “grammars” that Voce/Sphinx4 supports. I would think that SREC is must more powerful, as it allows me to articulate very expressive grammars, e.g., “Gun range nine five double-oh”, “up 400 left 8”, “Steer east by south”, “train red seventy”, “all ahead half” – I essentially use it to recognize much of what you’d say to navigate and fight a WW1 ship in a battle. That’s far beyond what I’ve ever seen in a game as far as recognition goes.

It is C/C++ source code and I have it working as a JNI dylib on OS X only. I build it using some manhandled and ugly Makefiles that I had to really tear apart from the Android build system.
I have no idea how to make a DLL of it – can anyone here help me do this so Windows can work with it?

tone