title: Speech recognition in C or Java or PHP?
body: <p>Is there any well known established framework for C or Java or PHP to do speech recognition applications? Microphone audio input and it will recognize English words. Such as pseudo code:</p>
  
  <pre><code>Speech s = new Speech();
  s.input(micStream);
  result = s.recognise("Hello");
  if (result) { printf("Matched hello"); } else { printf("No match found"); }
  </code></pre>
  
  <p><strong>Follow up:</strong></p>
  
  <p>Download this: <a href="http://sourceforge.net/projects/cmusphinx/files/sphinx4/1.0%20beta6/" rel="noreferrer">sphinx4/1.0%20beta6/</a></p>
  
  <p><img src="https://i.stack.imgur.com/Sx4HP.png" alt="enter image description here"></p>
  
  <ol start="2">
  <li><p>Add the libraries</p></li>
  <li><p>Copy &amp; paste code:</p>
  
  <p>a) xml file put somewhere, which can be loaded from the code:                                </p>
  
  <p><a href="https://gist.github.com/2551321" rel="noreferrer">https://gist.github.com/2551321</a></p>
  
  <p>b) use this:</p>
  
  <pre><code>package edu.cmu.sphinx.demo.hellowrld;
  import edu.cmu.sphinx.frontend.util.Microphone;
  import edu.cmu.sphinx.recognizer.Recognizer;
  import edu.cmu.sphinx.result.Result;
  import edu.cmu.sphinx.util.props.ConfigurationManager;
  import java.io.IOException;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  import models.Tts;
  
  public class Speech {
  
    public static void main(String[] args) {
      ConfigurationManager cm;
  
      if (args.length &gt; 0) {
          cm = new ConfigurationManager(args[0]);
      } else {
          ///tmp/helloworld.config.xml
          cm = new ConfigurationManager(Speech.class.getResource("speech.config.xml"));
  
      }
      Recognizer recognizer = (Recognizer) cm.lookup("recognizer");
      recognizer.allocate();
  
      Microphone microphone = (Microphone) cm.lookup("microphone");
      if (!microphone.startRecording()) {
          System.out.println("Cannot start microphone.");
          recognizer.deallocate();
          System.exit(1);
      }
  
      System.out.println("Say: (Hello | call) ( Naam | Baam | Caam | Some )");
  
      while (true) {
          System.out.println("Start speaking. Press Ctrl-C to quit.\n");
  
          Result result = recognizer.recognize();
  
          if (result != null) {
              String resultText = result.getBestFinalResultNoFiller();
              System.out.println("You said: " + resultText + '\n');
  
                  Tts ts = new Tts();
                  try {
                      ts.load();
                      ts.say("Did you said: " + resultText);
                  } catch (IOException ex) {
  
                  } 
          } else {
              System.out.println("I can't hear what you said.\n");
          }
      }
    }
  }
  </code></pre></li>
  </ol>