2011-05-27 17 views
24

是否有任何知名的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"); } 

隨訪:

下載此:sphinx4/1.0%20beta6/

enter image description here

  • 添加庫

  • 複製&粘貼代碼:

    一)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"); 
         } 
        } 
        } 
    } 
    
  • +2

    已被要求,並回答了對Java已經:http://stackoverflow.com/questions/3034925/java-speech-recognition-api – 2011-05-27 11:10:35

    回答

    3

    嗯。一個有趣的話題。儘管我很多年前在Amiga上玩過一些(非常基本的)語音識別軟件,但我還是花了相當多的時間去研究這類事情。這很有趣,但不像您的僞代碼示例使它聽起來那麼容易。

    您將需要一個第三方API庫。 (我想這是可能寫你自己的,但我不認爲你是這是一個可行的想法點)

    有一些API庫可用;谷歌出現了幾個 - 這是我得到的結果之一:http://en.wikipedia.org/wiki/Microsoft_Speech_API - 但你可能需要嘗試幾個,直到你得到一個滿足你的需求。

    這個機會將成爲一個商業化的API - 即你必須爲此付費。可能有一些開源軟件(我在粗略的Googleing中沒有看到,但我確定它們存在),但它們可能會更難以使用。一旦你有一個你感到滿意的圖書館,並且你已經編寫了你的​​代碼來與它交互,你的工作就沒有完成,因爲語音識別是一個非常棘手的工作。

    不同的口音只是問題的開始。說話者的性別和他們說話的速度也會影響認識到所說的話的能力。人類是遠遠更好地認識言語比電腦,但即使我們與一些陌生的口音糾纏。

    通常需要對語音識別軟件進行培訓以識別特定的單詞和短語。在你的例子中,你肯定不會嘗試匹配一個字符串;你會要求它發現一個特定的被訓練識別的短語。

    總之,這是一個非常大的領域,你顯然只是把你的腳趾浸入。我希望它適合你,但我看到你們在不久的將來會有很多研究時間!

    這裏有一些其他的鏈接可以幫助您:

    4

    從看這些問題的幾月NTHS,我見過的最開發商選擇打破這樣的:

    Windows操作系統的用戶 - 使用.NET或Microsoft.Speech的System.Speech功能並安裝免費的識別Microsoft提供。 Windows 7包含一個完整的語音引擎。其他人可免費下載。有一個C++ API與SAPI相同的引擎。請參閱http://msdn.microsoft.com/en-us/magazine/cc163663.aspx。或http://msdn.microsoft.com/en-us/library/ms723627(v=vs.85).aspx。 Windows微軟引擎的更多背景 What is the difference between System.Speech.Recognition and Microsoft.Speech.Recognition?

    Linux人 - 獅身人面像似乎有一個良好的關注。見http://cmusphinx.sourceforge.net/http://cmusphinx.sourceforge.net/wiki/

    商業產品 - Nuance的,Loquendo,AT & T,其他

    在線服務 - 細微差別,Yapme,別人

    當然,這也可能是有益的 - http://en.wikipedia.org/wiki/List_of_speech_recognition_software

    有是一個Java語音API。見javax.speech.recognition了Java語音APIhttp://java.sun.com/products/java-media/speech/forDevelopers/jsapi-guide/Recognition.html英寸我相信你仍然需要找到一個支持這個API的語音引擎。我不認爲獅身人面像完全支持它 - http://cmusphinx.sourceforge.net/sphinx4/doc/Sphinx4-faq.html#support_jsapi

    還有很多其他SO quesitons的: Need text to speech and speech recognition tools for Linux

    1

    試試我的C庫,libsprec,這是圍繞谷歌的語音識別引擎,內置:

    http://github.com/H2CO3/libsprec

    +0

    @ syb0rg如果你願意的話,請聯繫我的Twitter或通過電子郵件。我不知道那些神祕的錯誤可能是「編譯器不會發現的」。圖書館最近更新了各種錯誤修正和安全改進,你確定你沒有看舊版本嗎? – 2013-06-26 04:58:35

    +0

    @ syb0rg免費覺得邀請我聊天! – 2013-06-26 05:21:33