Using Sphinx4: java.lang.IncompatibleClassChangeError

403 views Asked by At

I am trying to build a program that will use basic voice recognition. I am encounter a issue while attempting to look up the "recognizer" component in the voice.config.xml file. I am relatively new to using Sphinx4 so it could be a very simple mistake. I have spent hours trying to find it so a well explained and detailed response would be greatly appreciated.

This is the methods that I will use to translate the input.

    public static void translate() {

    URL url = S2T.class.getResource("voice.config.xml");

    ConfigurationManager cm = new ConfigurationManager(url);
    PropertySheet ps = cm.getPropertySheet("voice.config.xml");


    Microphone microphone = (Microphone) cm.lookup("microphone");
    Recognizer recognizer = (Recognizer) cm.lookup("recognizer");


     recognizer.allocate();

     if(microphone.startRecording()) {
         while(true) {
              Result result = recognizer.recognize();
              String resultText = result.getBestResultNoFiller();
              System.out.println("You said: " + resultText);
         }
     }
}

This is the error that I am getting when I call the method from another class:

Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class edu.cmu.sphinx.util.props.PropertySheet, but interface was expected
    at edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model.newProperties(Model.java:158)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.setupAcousticModel(FlatLinguist.java:278)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:244)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchManager.java:182)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:65)
    at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:37)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:90)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:161)
    at LukeTrujillo.CAB.Voice.S2T.translate(S2T.java:25)
    at LukeTrujllo.CAB.Main.Main.main(Main.java:14)

This is the my current build path for the package that this class is in:

LukeTrujillo/CAB/Voice/
- Main.java
- S2T.gram
- voice.config.xml
- voice.Manifest

Sphinx JARs in Classpath:

  • js.jar
  • jsapi-1.0-base.jar
  • sphinx4.jar
  • tags.jar
  • jl1.01.jar
  • resty-0.3.2.jar
  • WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
  • TIDIGITS_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar
1

There are 1 answers

0
Nikolay Shmyrev On

You are using outdated sphinx4 with incompatible versions. You can find a tutorial and the latest downloads on CMUSphinx website:

http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4