cmusphinx / sphinx4

Pure Java speech recognition library
cmusphinx.sourceforge.net
Other
1.4k stars 586 forks source link

JSGF Engine #97

Open roddar92 opened 4 years ago

roddar92 commented 4 years ago

Dear colleagues, I tried to start JSGF from Sphinx4 library. But I can't find a good demo with grammars and queries to check how it works.

Could you suggest me any instructions for launching JSGF engine?

Regards, Daria

SwimmingTiger commented 3 years ago

Here is a demo about JSGF: https://github.com/cmusphinx/sphinx4/blob/8707586053de5c49ba0d698f949ba7e6b6c987ee/sphinx4-samples/src/main/java/edu/cmu/sphinx/demo/dialog/DialogDemo.java#L132-L185

The JSGF grammar file it uses: https://github.com/cmusphinx/sphinx4/blob/8707586053de5c49ba0d698f949ba7e6b6c987ee/sphinx4-samples/src/main/resources/edu/cmu/sphinx/demo/dialog/dialog.gram#L1-L29

If you are on Windows, you need to edit this file to start the demo: https://github.com/cmusphinx/sphinx4/blob/8707586053de5c49ba0d698f949ba7e6b6c987ee/sphinx4-core/src/main/java/edu/cmu/sphinx/api/SpeechSourceProvider.java#L15-L20

// Change the class to this
public class SpeechSourceProvider {
    private static final Microphone mic = new Microphone(16000, 16, true, false);

    Microphone getMicrophone() {
        return mic;
    }
}

See details for the bug: https://stackoverflow.com/questions/29121188/cant-access-microphone-while-running-dialog-demo-in-sphinx4-5prealpha