Skip to content

Instantly share code, notes, and snippets.

@ilmoeuro
Last active March 9, 2018 20:03
Show Gist options
  • Save ilmoeuro/2fe8e974f5c50b26e8e73551bd50cfea to your computer and use it in GitHub Desktop.
Save ilmoeuro/2fe8e974f5c50b26e8e73551bd50cfea to your computer and use it in GitHub Desktop.
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