1

我正在尝试转换音频文件,下面是我的代码

public class test {
    public static void main(String[] args) throws Exception {
        System.out.println("Loading models...");

                Configuration configuration = new Configuration();

                // Load model from the jar
                configuration.setAcousticModelPath("resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz");
                configuration.setDictionaryPath("resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/cmudict.0.6d");        
                configuration.setLanguageModelPath("models/language/en-us.lm.dmp");

                StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration);


                URL audioUrl = new URL("file:///C:/Sound1.wav");
                recognizer.startRecognition(audioUrl.openStream());

                SpeechResult result;

                while ((result = recognizer.getResult()) != null) {
                    System.out.format("Hypothesis: %s\n",
                                      result.getHypothesis());
                }

                System.out.println("Stop Recognition..");
                recognizer.stopRecognition();
            }
        }

但我在线上遇到了异常 while ((result = recognizer.getResult()) != null)

Exception in thread "main" java.lang.NegativeArraySizeException
    at edu.cmu.sphinx.frontend.feature.LiveCMN.initMeansSums(LiveCMN.java:130)
    at edu.cmu.sphinx.frontend.feature.LiveCMN.getData(LiveCMN.java:161)

请建议我如何解决这个问题。

4

1 回答 1

0

此问题已在修订版 12586 的颠覆中得到修复。

于 2014-09-06T17:08:35.090 回答