first of all, hello everyone. I'm new here. I implemented a program which intended to translate a .wav file into text. But everytime I get the OutOfMemoryError when the program execute until the allocate() of recognizer. The program looks like:
Before the invocation of the method above, the recognizer has been generated successfully by the configurationmanager loaded from the following configuration file sttconfig.xml:
first of all, hello everyone. I'm new here. I implemented a program which intended to translate a .wav file into text. But everytime I get the OutOfMemoryError when the program execute until the allocate() of recognizer. The program looks like:
public String decodeWav(URL wavFileUrl){
String resultStr = null;
try {
AudioInputStream ais = AudioSystem.getAudioInputStream(wavFileUrl);
reader.setInputStream(ais, wavFileUrl.getFile()); recognizer.allocate();
Result result = recognizer.recognize();
recognizer.deallocate();
if(result!=null){
resultStr = result.getBestFinalResultNoFiller();
}else{console.info("cannot recognise speeche");
}
} catch (UnsupportedAudioFileException e) {
e.printStackTrace();
//console.error(e.);
} catch (IOException e) {
e.printStackTrace();
//console.error(e.getMessage());
}
return resultStr;
}
Before the invocation of the method above, the recognizer has been generated successfully by the configurationmanager loaded from the following configuration file sttconfig.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Sphinx-4 Configuration file
-->
<!-- ******** -->
<!-- tidigits configuration file -->
<!-- ******** -->
<config>
</config>
Who can tell me? What's wrong with the configuration file?
specify option
-mx256m in your java command line.
Arthur