!7 /* curl -XPOST 'https://api.wit.ai/speech?v=20160526' -i -L -H "Authorization: Bearer $TOKEN" -H "Content-Type: audio/wav" --data-binary "@20170226-024709.wav" */ p-tt { // make speech to recognize S originalText = "Hello Ice Cube"; File mp3File = william_silent(originalText); print("Calling wit.ai with " + toK(mp3File.length()) + " K mp3..."); S token = witAIToken(); URL url = new URL("https://api.wit.ai/speech?v=20160526"); URLConnection con = url.openConnection(); con.setRequestProperty("Authorization", "Bearer " + token); con.setRequestProperty("Content-Type", "audio/mpeg3"); con.setDoOutput(true); OutputStream out = con.getOutputStream(); file2stream(mp3File, out); out.flush(); S contents = loadPage(con, url); out.close(); print("JSON:"); print(contents); S text = getString(jsonDecodeMap(contents), "_text"); print("ORIGINAL TEXT: " + originalText); print("RECOGNIZED TEXT: " + text); print(); print(match(originalText, text) ? "FULL MATCH!" : "Not a full match."); }