Menu

java.lang.OutOfMemoryError

Help
yako
2006-03-14
2012-09-22
  • yako

    yako - 2006-03-14

    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>

    &lt;!-- ******************************************************** --&gt;
    &lt;!-- frequently tuned properties                              --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;property name=&quot;absoluteBeamWidth&quot;           value=&quot;-1&quot;/&gt;
    &lt;property name=&quot;relativeBeamWidth&quot;           value=&quot;1E-90&quot;/&gt;
    &lt;property name=&quot;wordInsertionProbability&quot;    value=&quot;1E-36&quot;/&gt;
    &lt;property name=&quot;languageWeight&quot;              value=&quot;8&quot;/&gt;
    &lt;property name=&quot;silenceInsertionProbability&quot; value=&quot;1&quot;/&gt;
    &lt;property name=&quot;skip&quot;                        value=&quot;0&quot;/&gt;
    &lt;property name=&quot;logLevel&quot;                    value=&quot;INFO&quot;/&gt;
    
    &lt;property name=&quot;recognizer&quot; value=&quot;recognizer&quot;/&gt;
    &lt;property name=&quot;linguist&quot;   value=&quot;flatLinguist&quot;/&gt;
    &lt;property name=&quot;frontend&quot;   value=&quot;mfcFrontEnd&quot;/&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The connectedDigitsRecognizer configuration               --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;recognizer&quot; 
               type=&quot;edu.cmu.sphinx.recognizer.Recognizer&quot;&gt;
        &lt;property name=&quot;decoder&quot; value=&quot;digitsDecoder&quot;/&gt;
        &lt;propertylist name=&quot;monitors&quot;&gt;
        &lt;/propertylist&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The Decoder   configuration                              --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;digitsDecoder&quot; type=&quot;edu.cmu.sphinx.decoder.Decoder&quot;&gt;
        &lt;property name=&quot;searchManager&quot; value=&quot;searchManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;searchManager&quot; 
        type=&quot;edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager&quot;&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;linguist&quot; value=&quot;${linguist}&quot;/&gt;
        &lt;property name=&quot;pruner&quot; value=&quot;trivialPruner&quot;/&gt;
        &lt;property name=&quot;scorer&quot; value=&quot;threadedScorer&quot;/&gt;
        &lt;property name=&quot;activeListFactory&quot; value=&quot;activeList&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;activeList&quot; 
             type=&quot;edu.cmu.sphinx.decoder.search.SortingActiveListFactory&quot;&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;absoluteBeamWidth&quot; value=&quot;${absoluteBeamWidth}&quot;/&gt;
        &lt;property name=&quot;relativeBeamWidth&quot; value=&quot;${relativeBeamWidth}&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;trivialPruner&quot; 
                type=&quot;edu.cmu.sphinx.decoder.pruner.SimplePruner&quot;/&gt;
    
    &lt;component name=&quot;threadedScorer&quot; 
                type=&quot;edu.cmu.sphinx.decoder.scorer.ThreadedAcousticScorer&quot;&gt;
        &lt;property name=&quot;frontend&quot; value=&quot;${frontend}&quot;/&gt;
        &lt;property name=&quot;isCpuRelative&quot; value=&quot;true&quot;/&gt;
        &lt;property name=&quot;numThreads&quot; value=&quot;0&quot;/&gt;
        &lt;property name=&quot;minScoreablesPerThread&quot; value=&quot;10&quot;/&gt;
        &lt;property name=&quot;scoreablesKeepFeature&quot; value=&quot;true&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The linguist  configuration                              --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;flatLinguist&quot; 
                type=&quot;edu.cmu.sphinx.linguist.flat.FlatLinguist&quot;&gt;
        &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;grammar&quot; value=&quot;jsgfGrammar&quot;/&gt;
        &lt;property name=&quot;acousticModel&quot; value=&quot;acousticModel&quot;/&gt;
        &lt;property name=&quot;wordInsertionProbability&quot; 
                value=&quot;${wordInsertionProbability}&quot;/&gt;
        &lt;property name=&quot;silenceInsertionProbability&quot; 
                value=&quot;${silenceInsertionProbability}&quot;/&gt;
        &lt;property name=&quot;languageWeight&quot; value=&quot;${languageWeight}&quot;/&gt;
        &lt;property name=&quot;unitManager&quot; value=&quot;unitManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The Grammar  configuration                               --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;jsgfGrammar&quot; type=&quot;edu.cmu.sphinx.jsapi.JSGFGrammar&quot;&gt;
        &lt;property name=&quot;dictionary&quot; value=&quot;dictionary&quot;/&gt;
        &lt;property name=&quot;grammarLocation&quot; 
             value=&quot;resource:/de.dailab.project.arm.stt.Wavdecoder!/&quot;/&gt;
        &lt;property name=&quot;grammarName&quot; value=&quot;answer&quot;/&gt;
    &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The Dictionary configuration                            --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;dictionary&quot; 
        type=&quot;edu.cmu.sphinx.linguist.dictionary.FastDictionary&quot;&gt;
        &lt;property name=&quot;dictionaryPath&quot;
        value=&quot;resource:/edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model!/edu/cmu/sphinx/model/acoustic/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/cmudict.0.6d&quot;/&gt;
        &lt;property name=&quot;fillerPath&quot;
        value=&quot;resource:/edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model!/edu/cmu/sphinx/model/acoustic/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz/dict/fillerdict&quot;/&gt;
        &lt;property name=&quot;addSilEndingPronunciation&quot; value=&quot;false&quot;/&gt;
        &lt;property name=&quot;allowMissingWords&quot; value=&quot;false&quot;/&gt;
        &lt;property name=&quot;unitManager&quot; value=&quot;unitManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The acoustic model configuration                         --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;acousticModel&quot; 
      type=&quot;edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.Model&quot;&gt;
        &lt;property name=&quot;loader&quot; value=&quot;wsjLoader&quot;/&gt;
        &lt;property name=&quot;unitManager&quot; value=&quot;unitManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;wsjLoader&quot;
           type=&quot;edu.cmu.sphinx.model.acoustic.WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.ModelLoader&quot;&gt;
    &lt;property name=&quot;logMath&quot; value=&quot;logMath&quot;/&gt;
        &lt;property name=&quot;unitManager&quot; value=&quot;unitManager&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The unit manager configuration                           --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;unitManager&quot; 
        type=&quot;edu.cmu.sphinx.linguist.acoustic.UnitManager&quot;/&gt;
    
    &lt;!-- ******************************************************** --&gt;
    &lt;!-- The frontend configuration                               --&gt;
    &lt;!-- ******************************************************** --&gt;
    
    &lt;component name=&quot;mfcFrontEnd&quot; type=&quot;edu.cmu.sphinx.frontend.FrontEnd&quot;&gt;
        &lt;propertylist name=&quot;pipeline&quot;&gt;
            &lt;item&gt;streamDataSource&lt;/item&gt;
            &lt;item&gt;premphasizer&lt;/item&gt;
            &lt;item&gt;windower&lt;/item&gt;
            &lt;item&gt;fft&lt;/item&gt;
            &lt;item&gt;melFilterBank&lt;/item&gt;
            &lt;item&gt;dct&lt;/item&gt;
            &lt;item&gt;batchCMN&lt;/item&gt;
            &lt;item&gt;featureExtraction&lt;/item&gt;
        &lt;/propertylist&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;streamDataSource&quot; 
                type=&quot;edu.cmu.sphinx.frontend.util.StreamDataSource&quot;&gt;
        &lt;property name=&quot;sampleRate&quot; value=&quot;16000&quot;/&gt;
    &lt;property name=&quot;bitsPerSample&quot; value=&quot;16&quot;/&gt;
    &lt;property name=&quot;bigEndianData&quot; value=&quot;false&quot;/&gt;
    &lt;property name=&quot;signedData&quot; value=&quot;true&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;premphasizer&quot; 
               type=&quot;edu.cmu.sphinx.frontend.filter.Preemphasizer&quot;/&gt;
    
    &lt;component name=&quot;windower&quot; 
               type=&quot;edu.cmu.sphinx.frontend.window.RaisedCosineWindower&quot;/&gt;
    
    &lt;component name=&quot;fft&quot; 
            type=&quot;edu.cmu.sphinx.frontend.transform.DiscreteFourierTransform&quot;/&gt;
    
    &lt;component name=&quot;melFilterBank&quot; 
          type=&quot;edu.cmu.sphinx.frontend.frequencywarp.MelFrequencyFilterBank&quot;/&gt;
    
    &lt;component name=&quot;dct&quot; 
            type=&quot;edu.cmu.sphinx.frontend.transform.DiscreteCosineTransform&quot;/&gt;
    
    &lt;component name=&quot;batchCMN&quot; 
               type=&quot;edu.cmu.sphinx.frontend.feature.BatchCMN&quot;/&gt;
    
    &lt;component name=&quot;featureExtraction&quot; 
               type=&quot;edu.cmu.sphinx.frontend.feature.DeltasFeatureExtractor&quot;/&gt;
    
    &lt;!-- ******************************************************* --&gt;
    &lt;!--  monitors                                               --&gt;
    &lt;!-- ******************************************************* --&gt;
    
    &lt;component name=&quot;memoryTracker&quot; 
                type=&quot;edu.cmu.sphinx.instrumentation.MemoryTracker&quot;&gt;
        &lt;property name=&quot;recognizer&quot; value=&quot;${recognizer}&quot;/&gt;
    &lt;/component&gt;
    
    &lt;component name=&quot;speedTracker&quot; 
                type=&quot;edu.cmu.sphinx.instrumentation.SpeedTracker&quot;&gt;
        &lt;property name=&quot;recognizer&quot; value=&quot;${recognizer}&quot;/&gt;
        &lt;property name=&quot;frontend&quot; value=&quot;${frontend}&quot;/&gt;
        &lt;property name=&quot;showTimers&quot; value=&quot;false&quot;/&gt;
    &lt;/component&gt;
    
    &lt;!-- ******************************************************* --&gt;
    &lt;!--  Miscellaneous components                               --&gt;
    &lt;!-- ******************************************************* --&gt;
    
    &lt;component name=&quot;logMath&quot; type=&quot;edu.cmu.sphinx.util.LogMath&quot;&gt;
        &lt;property name=&quot;logBase&quot; value=&quot;1.0001&quot;/&gt;
        &lt;property name=&quot;useAddTable&quot; value=&quot;true&quot;/&gt;
    &lt;/component&gt;
    

    </config>

    Who can tell me? What's wrong with the configuration file?

     
    • The Grand Janitor

      specify option
      -mx256m in your java command line.

      Arthur

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.