Exemplo n.º 1
0
 // ==========================================
 //  WSRMacro GOOGLE
 // // https://bitbucket.org/josephcooney/cloudspeech/src/8619cf699541?at=default
 // ==========================================
 public String ProcessAudioStream(Stream stream)
 {
     logInfo("GOOGLE", "ProcessAudioStream");
       CultureInfo culture = new System.Globalization.CultureInfo(WSRConfig.GetInstance().language);
       var stt = new SpeechToText("https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&maxresults=2", culture);
       var response = stt.Recognize(stream);
       foreach(TextResponse res in response){
     logInfo("GOOGLE", "Confidence: " + res.Confidence + " Utterance " + res.Utterance);
     return res.Utterance;
       }
       return null;
 }
Exemplo n.º 2
0
    // ==========================================
    //  GOOGLE
    //  https://bitbucket.org/josephcooney/cloudspeech/src/8619cf699541?at=default
    // ==========================================

    public String ProcessAudioStream(Stream stream, String language) {
      CultureInfo culture = new System.Globalization.CultureInfo(language);
      var key = WSRConfig.GetInstance().GoogleKey;
      if (key == null) {
        WSRConfig.GetInstance().logError("GOOGLE", "Missing Google Key required for the Google API v2 from https://console.developers.google.com/");
        return "No key for Google API";
      }

      var stt = new SpeechToText("https://www.google.com/speech-api/v2/recognize?output=json&xjerr=1&client=chromium&maxresults=2&key="+key, culture);
      return stt.Recognize(stream);
    }