是否有任何知名的C或Java或PHP語言識別應用程序框架?麥克風音頻輸入,它會識別英文單詞。如僞代碼:C或Java或PHP中的語音識別?
Speech s = new Speech();
s.input(micStream);
result = s.recognise("Hello");
if (result) { printf("Matched hello"); } else { printf("No match found"); }
隨訪:
添加庫
複製&粘貼代碼:
一)XML文件放在什麼地方,它可以從代碼加載:
https://gist.github.com/2551321
B)使用此:
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 > 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"); } } } }
已被要求,並回答了對Java已經:http://stackoverflow.com/questions/3034925/java-speech-recognition-api – 2011-05-27 11:10:35