資源簡介
訊飛語音實時在線識別,百度語音實時在線識別

代碼片段和文件信息
using?NAudio.Wave;
using?SoundToTextDemo.Model;
using?SoundToTextDemo.Utility;
using?System;
using?System.Collections.Concurrent;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?SoundToTextDemo
{
????public?partial?class?BaiDuMainForm?:?Form
????{
????????private?WaveIn?wis?=?null;
????????private?WaveFormat?pcmconfig?=?null;
????????private?bool?pullmark?=?false;
????????///?
????????///?語音隊列
????????///?
????????private?static?readonly?ConcurrentQueue?cq?=?new?ConcurrentQueue();
????????//當前的互斥鎖
????????private?static?readonly?Testcode?code?=?new?Testcode();
????????private?static?object?mutext?=?new?object();
????????public?BaiDuMainForm()
????????{
????????????InitializeComponent();
????????????int?audio_rate?=?16000;//?設置成8000會出現不是說話的內容
????????????int?audio_byte?=?16;
????????????int?audio_channle?=?1;
????????????this.pcmconfig?=?new?WaveFormat(audio_rate?audio_byte?audio_channle);
????????????if?(this.wis?==?null)
????????????{
????????????????this.wis?=?new?WaveIn();
????????????}
????????????this.wis.DataAvailable?+=?wis_DataAvailable;
??????????
????????????
????????}
????????private?void?wis_DataAvailable(object?sender?WaveInEventArgs?e)
????????{
????????????if?(e.Buffer?!=?null?&&?e.BytesRecorded?>?0)
????????????{
????????????????cq.Enqueue(e.Buffer);
????????????}
????????}
????????private?void?btn_start_Click(object?sender?EventArgs?e)
????????{
????????????try
????????????{
????????????????btn_start.Enabled?=?false;
????????????????btn_stop.Enabled?=?true;
????????????????this.wis.DeviceNumber?=?0;
????????????????this.wis.WaveFormat?=?this.pcmconfig;
????????????????this.wis.BufferMilliseconds?=?6000;
????????????????//?this.bytelength?=?(uint)((float)(audio_rate?*?(audio_byte?/?8))?*?((float)this.wis.BufferMilliseconds?/?1000f));
????????????????this.wis.StartRecording();
????????????????pullmark?=?true;
????????????????Task.Factory.StartNew(()?=>
????????????????{
????????????????????while?(pullmark)
????????????????????{
????????????????????????if?(!cq.IsEmpty)
????????????????????????{
????????????????????????????ReciveDataModel?redata?=?null;
????????????????????????????byte[]?localValue;
????????????????????????????cq.TryDequeue(out?localValue);
????????????????????????????DataSendModel?model?=?new?DataSendModel(DataEnum.FormatEnum.wav?16000?ConfigHelper.Instance.Token?Guid.NewGuid().ToString(“N“));
????????????????????????????model.len?=?(int)localValue.Length;
????????????????????????????model.speech?=?Convert.Tobase64String(localValue);
????????????????????????????string?poststr?=?Newtonsoft.Json.JsonConvert.Serializeobject(model);
????????????????????????????string?str?=?code.GetResponseStr(ConfigHelper.Instance.ApiUrl?poststr);
??????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????497??2016-09-21?11:57??SoundToTextDemo\SoundToTextDemo\App.config
?????文件???????4588??2016-09-21?14:17??SoundToTextDemo\SoundToTextDemo\BaiDuMainForm.cs
?????文件???????6385??2016-06-17?16:36??SoundToTextDemo\SoundToTextDemo\BaiDuMainForm.Designer.cs
?????文件???????5817??2016-06-17?16:36??SoundToTextDemo\SoundToTextDemo\BaiDuMainForm.resx
?????文件????6238674??2016-09-21?11:22??SoundToTextDemo\SoundToTextDemo\bin\Debug\msc.log
?????文件???10484951??2016-06-17?17:01??SoundToTextDemo\SoundToTextDemo\bin\Debug\msc_2016617_1713.log
?????文件???10484934??2016-09-20?15:29??SoundToTextDemo\SoundToTextDemo\bin\Debug\msc_2016920_152927.log
?????文件????????140??2016-09-21?11:22??SoundToTextDemo\SoundToTextDemo\bin\Debug\msc_assist.dat
?????文件?????364544??2015-04-13?09:51??SoundToTextDemo\SoundToTextDemo\bin\Debug\msc_old.dll
?????文件?????471040??2016-06-17?14:02??SoundToTextDemo\SoundToTextDemo\bin\Debug\NAudio.dll
?????文件?????940967??2016-06-17?14:02??SoundToTextDemo\SoundToTextDemo\bin\Debug\NAudio.xm
?????文件?????485888??2016-06-17?14:02??SoundToTextDemo\SoundToTextDemo\bin\Debug\Newtonsoft.Json.dll
?????文件?????516075??2016-06-17?14:02??SoundToTextDemo\SoundToTextDemo\bin\Debug\Newtonsoft.Json.xm
?????文件??????44544??2016-09-21?12:21??SoundToTextDemo\SoundToTextDemo\bin\Debug\SoundToTextDemo.exe
?????文件????????497??2016-09-21?11:57??SoundToTextDemo\SoundToTextDemo\bin\Debug\SoundToTextDemo.exe.config
?????文件?????108032??2016-09-21?12:21??SoundToTextDemo\SoundToTextDemo\bin\Debug\SoundToTextDemo.pdb
?????文件??????24224??2016-09-21?12:21??SoundToTextDemo\SoundToTextDemo\bin\Debug\SoundToTextDemo.vshost.exe
?????文件????????497??2016-09-21?11:57??SoundToTextDemo\SoundToTextDemo\bin\Debug\SoundToTextDemo.vshost.exe.config
?????文件????????490??2015-11-13?10:24??SoundToTextDemo\SoundToTextDemo\bin\Debug\SoundToTextDemo.vshost.exe.manifest
?????文件?????278528??2015-04-14?20:14??SoundToTextDemo\SoundToTextDemo\bin\Debug\speex.dll
?????文件????1099666??2016-06-17?17:01??SoundToTextDemo\SoundToTextDemo\bin\Debug.rar
?????文件?????471040??2016-06-17?14:02??SoundToTextDemo\SoundToTextDemo\bin\Release\NAudio.dll
?????文件?????940967??2016-06-17?14:02??SoundToTextDemo\SoundToTextDemo\bin\Release\NAudio.xm
?????文件?????485888??2016-06-17?14:02??SoundToTextDemo\SoundToTextDemo\bin\Release\Newtonsoft.Json.dll
?????文件?????516075??2016-06-17?14:02??SoundToTextDemo\SoundToTextDemo\bin\Release\Newtonsoft.Json.xm
?????文件??????42496??2016-09-21?14:14??SoundToTextDemo\SoundToTextDemo\bin\Release\SoundToTextDemo.exe
?????文件????????497??2016-09-21?11:57??SoundToTextDemo\SoundToTextDemo\bin\Release\SoundToTextDemo.exe.config
?????文件??????85504??2016-09-21?14:14??SoundToTextDemo\SoundToTextDemo\bin\Release\SoundToTextDemo.pdb
?????文件??????24216??2016-09-21?14:16??SoundToTextDemo\SoundToTextDemo\bin\Release\SoundToTextDemo.vshost.exe
?????文件????????497??2016-09-21?11:57??SoundToTextDemo\SoundToTextDemo\bin\Release\SoundToTextDemo.vshost.exe.config
............此處省略88個文件信息
- 上一篇:污水處理PLC控制系統及組態王顯示
- 下一篇:8路搶答器設計八路智力競賽搶答器
評論
共有 條評論