title: Dictation Application using Sphinx4
body: <p>My requirements are similar to <a href="https://stackoverflow.com/questions/1516863/getting-wav-file-transcription-to-work-with-sphinx4">this question</a> since the question is now 3 years old I am re-posting the question with information specific to mine, I want to  create an application which takes a .wav (or any other standard audio file format) and converts it to text.</p>
  
  <p>For Speech Recognition I have decided to use sphinx4, I am trying to enhance the Transcriber  demo provided with sphinx. Its good but That only works for a specific Grammar (written in .gram and .gxml files). </p>
  
  <p><strong>EDIT</strong>
  To be able to use it with English ? I am trying to configure it with VoxForge_en_0.4. My config.XML file looks like:-</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;!--
     Sphinx-4 Configuration file
  --&gt;
  
  &lt;!-- ******************************************************** --&gt;
  &lt;!--  biship  configuration file                              --&gt;
  &lt;!-- ******************************************************** --&gt;
  
  &lt;config&gt;        
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- frequently tuned properties                              --&gt;
      &lt;!-- ******************************************************** --&gt; 
      &lt;property name="absoluteBeamWidth"  value="500"/&gt;
      &lt;property name="relativeBeamWidth"  value="1E-80"/&gt;
      &lt;property name="absoluteWordBeamWidth" value="20"/&gt;
      &lt;property name="relativeWordBeamWidth" value="1E-60"/&gt;
      &lt;property name="wordInsertionProbability" value="1E-16"/&gt;
      &lt;property name="languageWeight" value="7.0"/&gt;
      &lt;property name="silenceInsertionProbability" value=".1"/&gt;
      &lt;property name="frontend" value="epFrontEnd"/&gt;
      &lt;property name="recognizer" value="recognizer"/&gt;
      &lt;property name="showCreations" value="false"/&gt;
  
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- word recognizer configuration                            --&gt;
      &lt;!-- ******************************************************** --&gt; 
  
      &lt;component name="recognizer" 
                            type="edu.cmu.sphinx.recognizer.Recognizer"&gt;
          &lt;property name="decoder" value="decoder"/&gt;
          &lt;propertylist name="monitors"&gt;
              &lt;item&gt;accuracyTracker &lt;/item&gt;
              &lt;item&gt;speedTracker &lt;/item&gt;
              &lt;item&gt;memoryTracker &lt;/item&gt;
              &lt;item&gt;recognizerMonitor &lt;/item&gt;
          &lt;/propertylist&gt;
      &lt;/component&gt;
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The Decoder   configuration                              --&gt;
      &lt;!-- ******************************************************** --&gt; 
  
      &lt;component name="decoder" type="edu.cmu.sphinx.decoder.Decoder"&gt;
          &lt;property name="searchManager" value="wordPruningSearchManager"/&gt;
          &lt;property name="featureBlockSize" value="50"/&gt;
      &lt;/component&gt;
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The Search Manager                                       --&gt;
      &lt;!-- ******************************************************** --&gt; 
  
      &lt;component name="wordPruningSearchManager" 
      type="edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager"&gt;
          &lt;property name="logMath" value="logMath"/&gt;
          &lt;property name="linguist" value="lexTreeLinguist"/&gt;
          &lt;property name="pruner" value="trivialPruner"/&gt;
          &lt;property name="scorer" value="threadedScorer"/&gt;
          &lt;property name="activeListManager" value="activeListManager"/&gt;
          &lt;property name="growSkipInterval" value="0"/&gt;
          &lt;property name="checkStateOrder" value="false"/&gt;
          &lt;property name="buildWordLattice" value="true"/&gt;
          &lt;property name="acousticLookaheadFrames" value="1.7"/&gt;
          &lt;property name="relativeBeamWidth" value="${relativeBeamWidth}"/&gt;
      &lt;/component&gt;
  
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The Active Lists                                         --&gt;
      &lt;!-- ******************************************************** --&gt; 
  
      &lt;component name="activeListManager" 
               type="edu.cmu.sphinx.decoder.search.SimpleActiveListManager"&gt;
          &lt;propertylist name="activeListFactories"&gt;
              &lt;item&gt;standardActiveListFactory&lt;/item&gt;
              &lt;item&gt;wordActiveListFactory&lt;/item&gt;
              &lt;item&gt;wordActiveListFactory&lt;/item&gt;
              &lt;item&gt;standardActiveListFactory&lt;/item&gt;
              &lt;item&gt;standardActiveListFactory&lt;/item&gt;
              &lt;item&gt;standardActiveListFactory&lt;/item&gt;
          &lt;/propertylist&gt;
      &lt;/component&gt;
  
      &lt;component name="standardActiveListFactory" 
               type="edu.cmu.sphinx.decoder.search.PartitionActiveListFactory"&gt;
          &lt;property name="logMath" value="logMath"/&gt;
          &lt;property name="absoluteBeamWidth" value="${absoluteBeamWidth}"/&gt;
          &lt;property name="relativeBeamWidth" value="${relativeBeamWidth}"/&gt;
      &lt;/component&gt;
  
      &lt;component name="wordActiveListFactory" 
               type="edu.cmu.sphinx.decoder.search.PartitionActiveListFactory"&gt;
          &lt;property name="logMath" value="logMath"/&gt;
          &lt;property name="absoluteBeamWidth" value="${absoluteWordBeamWidth}"/&gt;
          &lt;property name="relativeBeamWidth" value="${relativeWordBeamWidth}"/&gt;
      &lt;/component&gt;
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The Pruner                                               --&gt;
      &lt;!-- ******************************************************** --&gt; 
      &lt;component name="trivialPruner" 
                  type="edu.cmu.sphinx.decoder.pruner.SimplePruner"/&gt;
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- TheScorer                                                --&gt;
      &lt;!-- ******************************************************** --&gt; 
      &lt;component name="threadedScorer" 
                  type="edu.cmu.sphinx.decoder.scorer.ThreadedAcousticScorer"&gt;
          &lt;property name="frontend" value="${frontend}"/&gt;
      &lt;/component&gt;
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The linguist  configuration                              --&gt;
      &lt;!-- ******************************************************** --&gt;
  
      &lt;component name="lexTreeLinguist" 
                  type="edu.cmu.sphinx.linguist.lextree.LexTreeLinguist"&gt;
          &lt;property name="logMath" value="logMath"/&gt;
          &lt;property name="acousticModel" value="wsj"/&gt;
          &lt;property name="languageModel" value="trigramModel"/&gt;
          &lt;property name="dictionary" value="dictionary"/&gt;
          &lt;property name="addFillerWords" value="false"/&gt;
          &lt;property name="fillerInsertionProbability" value="1E-10"/&gt;
          &lt;property name="generateUnitStates" value="false"/&gt;
          &lt;property name="wantUnigramSmear" value="true"/&gt;
          &lt;property name="unigramSmearWeight" value="1"/&gt;
          &lt;property name="wordInsertionProbability" 
                  value="${wordInsertionProbability}"/&gt;
          &lt;property name="silenceInsertionProbability" 
                  value="${silenceInsertionProbability}"/&gt;
          &lt;property name="languageWeight" value="${languageWeight}"/&gt;
          &lt;property name="unitManager" value="unitManager"/&gt;
      &lt;/component&gt;    
  
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The Dictionary configuration                            --&gt;
      &lt;!-- ******************************************************** --&gt;
      &lt;component name="dictionary" 
          type="edu.cmu.sphinx.linguist.dictionary.FastDictionary"&gt;
          &lt;property name="dictionaryPath"
                    value="file:src/voxforge-en-0.4/etc/cmudict.0.7a"/&gt;
          &lt;property name="fillerPath" 
                value="file:src/voxforge-en-0.4/model_parameters/voxforge_en_sphinx.cd_cont_5000/noisedict"/&gt;
          &lt;property name="addSilEndingPronunciation" value="false"/&gt;
          &lt;property name="wordReplacement" value="&amp;lt;sil&amp;gt;"/&gt;
          &lt;property name="unitManager" value="unitManager"/&gt;
      &lt;/component&gt;
  
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The Language Model configuration                         --&gt;
      &lt;!-- ******************************************************** --&gt;
      &lt;component name="trigramModel" 
            type="edu.cmu.sphinx.linguist.language.ngram.large.LargeTrigramModel"&gt;
          &lt;property name="unigramWeight" value=".5"/&gt;
          &lt;property name="maxDepth" value="3"/&gt;
          &lt;property name="logMath" value="logMath"/&gt;
          &lt;property name="dictionary" value="dictionary"/&gt;
          &lt;property name="location" value="file:src/voxforge-en-0.4/wsj5k.DMP"/&gt;
  &lt;!--      &lt;property name="location"   value="file:src/voxforge-Language/language_model.arpaformat.DMP"/&gt;--&gt;
      &lt;/component&gt;
  
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The acoustic model configuration                         --&gt;
      &lt;!-- ******************************************************** --&gt;
      &lt;component name="wsj"
                 type="edu.cmu.sphinx.linguist.acoustic.tiedstate.TiedStateAcousticModel"&gt;
          &lt;property name="loader" value="wsjLoader"/&gt;
          &lt;property name="unitManager" value="unitManager"/&gt;
      &lt;/component&gt;
  
      &lt;component name="wsjLoader" type="edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader"&gt;
          &lt;property name="logMath" value="logMath"/&gt;
          &lt;property name="unitManager" value="unitManager"/&gt;
  &lt;!--        &lt;property name="location" value="file:src/hub4opensrc.cd_continuous_8gau"/&gt;--&gt;
          &lt;property name="location" value="file:src/voxforge-en-0.4/model_parameters/voxforge_en_sphinx.cd_cont_5000" /&gt;
          &lt;property name="dataLocation" value=""/&gt;
      &lt;/component&gt;
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The unit manager configuration                           --&gt;
      &lt;!-- ******************************************************** --&gt;
  
      &lt;component name="unitManager" 
          type="edu.cmu.sphinx.linguist.acoustic.UnitManager"/&gt;
  
  
      &lt;!-- ******************************************************** --&gt;
      &lt;!-- The frontend configuration                               --&gt;
      &lt;!-- ******************************************************** --&gt;
  
      &lt;component name="epFrontEnd" type="edu.cmu.sphinx.frontend.FrontEnd"&gt;
          &lt;propertylist name="pipeline"&gt;
              &lt;item&gt;audioFileDataSource &lt;/item&gt;
              &lt;item&gt;dataBlocker &lt;/item&gt;
              &lt;item&gt;speechClassifier &lt;/item&gt;
              &lt;item&gt;speechMarker &lt;/item&gt;
              &lt;item&gt;nonSpeechDataFilter &lt;/item&gt;
              &lt;item&gt;preemphasizer &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;liveCMN &lt;/item&gt;
              &lt;item&gt;featureExtraction &lt;/item&gt;
          &lt;/propertylist&gt;
      &lt;/component&gt;
  
      &lt;component name="audioFileDataSource" type="edu.cmu.sphinx.frontend.util.AudioFileDataSource"/&gt;
  
  
      &lt;component name="microphone" 
                  type="edu.cmu.sphinx.frontend.util.Microphone"&gt;
          &lt;property name="closeBetweenUtterances" value="false"/&gt;
      &lt;/component&gt;
  
      &lt;component name="dataBlocker" type="edu.cmu.sphinx.frontend.DataBlocker"/&gt;
  
      &lt;component name="speechClassifier"
                  type="edu.cmu.sphinx.frontend.endpoint.SpeechClassifier"&gt;
          &lt;property name="threshold" value="13"/&gt;
      &lt;/component&gt;
  
      &lt;component name="nonSpeechDataFilter" 
                  type="edu.cmu.sphinx.frontend.endpoint.NonSpeechDataFilter"/&gt;
  
      &lt;component name="speechMarker" 
                  type="edu.cmu.sphinx.frontend.endpoint.SpeechMarker"&gt;
          &lt;property name="speechTrailer" value="50"/&gt;
      &lt;/component&gt;
  
      &lt;component name="preemphasizer"
          type="edu.cmu.sphinx.frontend.filter.Preemphasizer"/&gt;
  
      &lt;component name="windower" 
      type="edu.cmu.sphinx.frontend.window.RaisedCosineWindower"/&gt;
  
      &lt;component name="fft" 
          type="edu.cmu.sphinx.frontend.transform.DiscreteFourierTransform"/&gt;
  
      &lt;component name="melFilterBank" 
          type="edu.cmu.sphinx.frontend.frequencywarp.MelFrequencyFilterBank"/&gt;
  
      &lt;component name="dct" 
              type="edu.cmu.sphinx.frontend.transform.DiscreteCosineTransform"/&gt;
  
      &lt;component name="liveCMN" 
                  type="edu.cmu.sphinx.frontend.feature.LiveCMN"/&gt;
  
      &lt;component name="featureExtraction" 
          type="edu.cmu.sphinx.frontend.feature.DeltasFeatureExtractor"/&gt;
  
      &lt;!-- ******************************************************* --&gt;
      &lt;!--  monitors                                               --&gt;
      &lt;!-- ******************************************************* --&gt;
  
      &lt;component name="accuracyTracker" 
                  type="edu.cmu.sphinx.instrumentation.BestPathAccuracyTracker"&gt;
          &lt;property name="recognizer" value="${recognizer}"/&gt;
          &lt;property name="showRawResults" value="false"/&gt;
          &lt;property name="showAlignedResults" value="false"/&gt;
      &lt;/component&gt;
  
      &lt;component name="memoryTracker" 
                  type="edu.cmu.sphinx.instrumentation.MemoryTracker"&gt;
          &lt;property name="recognizer" value="${recognizer}"/&gt;
          &lt;property name="showDetails" value="false"/&gt;
          &lt;property name="showSummary" value="false"/&gt;
      &lt;/component&gt;
  
      &lt;component name="speedTracker" 
                  type="edu.cmu.sphinx.instrumentation.SpeedTracker"&gt;
          &lt;property name="recognizer" value="${recognizer}"/&gt;
          &lt;property name="frontend" value="${frontend}"/&gt;
          &lt;property name="showDetails" value="false"/&gt;
      &lt;/component&gt;
  
      &lt;component name="recognizerMonitor" 
                  type="edu.cmu.sphinx.instrumentation.RecognizerMonitor"&gt;
          &lt;property name="recognizer" value="${recognizer}"/&gt;
          &lt;propertylist name="allocatedMonitors"&gt;
              &lt;item&gt;configMonitor &lt;/item&gt;
          &lt;/propertylist&gt;
      &lt;/component&gt;
  
      &lt;component name="configMonitor" 
                  type="edu.cmu.sphinx.instrumentation.ConfigMonitor"&gt;
          &lt;property name="showConfig" value="false"/&gt;
      &lt;/component&gt;
  
  
      &lt;!-- ******************************************************* --&gt;
      &lt;!--  Miscellaneous components                               --&gt;
      &lt;!-- ******************************************************* --&gt;
  
      &lt;component name="logMath" type="edu.cmu.sphinx.util.LogMath"&gt;
          &lt;property name="logBase" value="1.0001"/&gt;
          &lt;property name="useAddTable" value="true"/&gt;
      &lt;/component&gt;
  &lt;/config&gt;
  </code></pre>
  
  <p>Is their anything wrong with my configuration ? Plz help....</p>