void asr_DataAvailable(object sender, iFlyISR.DataArrivedEventArgs e) { result.Dispatcher.Invoke(new Action(() => { result.AppendText(e.result); })); }
private void button_Click(object sender, RoutedEventArgs e) { button.IsEnabled = false; //foreach (var wav in CreateWav) //{ // string c1 = "server_url=dev.voicecloud.cn,appid=4e7bf06d,timeout=10000"; // string c2 = "sub=iat,ssm=1,auf=audio/L16;rate=16000,aue=speex,ent=sms16k,rst=plain"; // iFlyISR isr = new iFlyISR(c1, c2); // //using(iFlyISR isr = new iFlyISR(c1, c2)) // //{ // // isr.DataArrived += new EventHandler<iFlyISR.DataArrivedEventArgs>(asr_DataAvailable); // // isr.ISREnd += new EventHandler(Isr_ISREnd); // // isr.Audio2TxtAsync(wav, null); // //} // isr.DataArrived += new EventHandler<iFlyISR.DataArrivedEventArgs>(asr_DataAvailable); // isr.ISREnd += new EventHandler(Isr_ISREnd); // isr.Audio2TxtAsync("wav", null); // isr.DataArrived -= new EventHandler<iFlyISR.DataArrivedEventArgs>(asr_DataAvailable); // isr.ISREnd -= new EventHandler(Isr_ISREnd); //} string c1 = "server_url=dev.voicecloud.cn,appid=51fc7487,timeout=10000"; string c2 = "sub=iat,ssm=1,auf=audio/L16;rate=16000,aue=speex,ent=sms16k,rst=plain"; iFlyISR isr = new iFlyISR(c1, c2); isr.DataArrived += new EventHandler<iFlyISR.DataArrivedEventArgs>(asr_DataAvailable); isr.ISREnd += new EventHandler(Isr_ISREnd); isr.Audio2TxtAsync(OutputFileName, null); }
public void TransSpeech(string speech) { button.IsEnabled = false; string c1 = "server_url=dev.voicecloud.cn,appid=51fc7487,timeout=10000"; string c2 = "sub=iat,ssm=1,auf=audio/L16;rate=16000,aue=speex,ent=sms16k,rst=plain"; iFlyISR isr = new iFlyISR(c1, c2); isr.DataArrived += new EventHandler<iFlyISR.DataArrivedEventArgs>(asr_DataAvailable); isr.ISREnd += new EventHandler(Isr_ISREnd); isr.Audio2TxtAsync(speech, null); }