Voce Libraries (CMUSphinx + FreeTTS) keeps giving "Not Valid Resource" error on grammar file

StackOverflow https://stackoverflow.com/questions/19131267

  •  30-06-2022
  •  | 
  •  

Question

The speech recognition example (recognitionTest.java) given with Voce doesn't compile and gives a "Not a Valid Resource" error for the grammar file. (digits.gram) I have tried using both relative and absolute paths in the init function, but the same error occurs in both cases. This happens on both the Processing example as well as the standalone Java example.

I have successfully developed apps for both CMUSphinx and FreeTTS individually and they work just fine, but not when using it via Voce.

I am using Windows 8 x64 version and Java version 1.7.0_25.

Please help out as I realize several other people on various forums are facing similar problems.

Was it helpful?

Solution

I emailed Tyler Streeter, the creator of Voce and he helped me solve this problem.

Basically, the voce.SpeechInterface.init() is actually looking for a File URL and not a String as such.

So, here is how to make the code work :

try {
    grammarPath = new File("\\Path\\To\\grammar\\").toURI().toURL().toString();
} catch (Exception e) {
    help.setText("" + e);
}
 voce.SpeechInterface.init("./lib", true, true, grammarPath, "digits");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top