using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.text;using system.windows.forms;using system.net;using system.io;using system.threading;using newtonsoft.json.linq;namespace voice{ public partial class form1 : form { string testtoken = ""; string cuid = "";//Casual Writing string serverURL = "Http://vop.baidu.com/server_api"; public form1 () { initializecomponent (); cuid&nbsP;= guid.newguid (). ToString (); } Private string post (String audiofilepath) { serverURL += "?lan=zh& Cuid=kwwwvagaa&token= " + testtoken; filestream fs = new filestream (Audiofilepath, filemode.open); byte[] voice = new byte[fs. Length]; fs. Read (Voice, 0, voice. Length); fs. Close (); fs. Dispose (); httpwebrequest request = null; uri uri = new uri (ServerURL); request = (HttpWebRequest) WebRequest.Create ( URI); request. Timeout = 5000; request. method = "POST"; request. contenttype = "audio/wav; rate=16000"; request. Contentlength = voice. length; try { using (stream writestream = request. GetRequestStream ()) { writestream.write (Voice, 0, voice. Length); writestream.close (); writestream.dispose (); } } catch { return null; } string result = string. empty; string result_final = string. empty; using (HttpWebResponse response = (HttpWebResponse) request. GetResponse ()) { using (stream Responsestream = response. GetResponseStream ()) { using (streamreader readstream = new StreamReader (Responsestream, encoding.utf8)) { string Line = string. empty; stringbuilder sb = new stringbuilder (); while (!readstream.endofstream) { line = readstream.readline ();       SB. Append (line);             SB. Append ("\ r"); } readstream.close (); &Nbsp; readstream.dispose ();            RESULT = SB. ToString (); string[] indexs = result. Split (', '); foreach (String index in indexs) { string[] _ Indexs = index. Split (' "'); if (_indexs[2] == ": [") result_final = _indexs[3]; } } responsestream.close (); responsestream.dispose (); } response. Close (); } return result_final; } private void button1_click (object Sender, eventargs e) { textbox1.text = post (application.startuppath + " \\2.wav "); } }}
The attachment has the source code, the specific look inside the Readme
C # call Baidu speech recognition demo