Last active
March 9, 2018 20:03
-
-
Save ilmoeuro/2fe8e974f5c50b26e8e73551bd50cfea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string DecodeSpeech() | |
{ | |
JContainer speechRequest = new JObject( | |
new JProperty("config", new JObject( | |
new JProperty("languageCode", new JValue("fi")) | |
)), | |
new JProperty("audio", new JObject( | |
new JProperty("content", base64Audio.text) | |
)) | |
); | |
var client = new RestClient("https://speech.googleapis.com/"); | |
var req = new RestRequest("v1/speech:recognize", Method.POST); | |
req.AddParameter("key", apiKey); | |
req.AddBody(speechRequest.ToString()); | |
var resp = client.Execute(req); | |
Debug.Log(resp.ErrorMessage); | |
Debug.Log(resp.ResponseStatus); | |
Debug.Log(resp.Content); | |
return resp.Content; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment