資源簡介
自己寫的。語音識別,語音合成,包含錄音文件。能運行,提供源碼大家共同學習謝謝

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Threading;
using?System.Collections;
using?XFVoice;
using?System.Media;
using?System.Diagnostics;
namespace?WinSound
{
????public?partial?class?CommData?:?Form
????{
????????//錄音線程
????????Thread?_Recrod;//開始錄音
????????Thread?_EndRecrod;//結束錄音
????????bool?_lyState;
????????int?_Count?=?0;//20秒計時
????????string?NameContext?=?““;
??????
????????Queue?myQ?=?new?Queue();
????????Queue?myTest?=?new?Queue();
????????Queue?myRead?=?new?Queue();
????????Queue?myShowRead?=?new?Queue();
????????//識別線程
????????Thread?_ReadFile;//處理語音文件
????????//處理朗讀線程
????????Thread?_ReadWav;//朗讀語音文件
????????public?CommData()
????????{
????????????InitializeComponent();
????????}
????????TTS?tts?=?new?TTS();
????????System.Media.SoundPlayer?sp?=?new?SoundPlayer();
????????private?void?timer1_Tick(object?sender?EventArgs?e)
????????{
????????????if?(listBox1.Items.Count?>?10)
????????????{
????????????????listBox1.Items.RemoveAt(0);
????????????}
????????????else
????????????{
????????????????if?(myShowRead.Count?>?0)
????????????????{
????????????????????listBox1.Items.Add(this.myShowRead.Dequeue().ToString());
????????????????}
????????????}
????????}
????????private?void?timer2_Tick(object?sender?EventArgs?e)
????????{
????????????if?(myRead.Count?>?0)
????????????{
????????????????if?(this.axWindowsMediaPlayer1.playState?==?WMPLib.WMPPlayState.wmppsUndefined?||?this.axWindowsMediaPlayer1.playState?==?WMPLib.WMPPlayState.wmppsStopped)
????????????????{
????????????????????this.axWindowsMediaPlayer1.URL?=?myRead.Dequeue().ToString();
????????????????????this.axWindowsMediaPlayer1.Ctlcontrols.play();
??????????????????
????????????????}
????????????}
????????}
????????#region?錄音部分
????????private?void?btnServer_Click(object?sender?EventArgs?e)
????????{
????????????btnServer.Enabled?=?false;
????????????btnEndServer.Enabled?=?true;
????????????_lyState?=?true;
????????
????????}????
????????private?void?btnEndServer_Click(object?sender?EventArgs?e)
????????{
????????????btnServer.Enabled?=true?;
????????????btnEndServer.Enabled?=?false;
????????????_lyState?=?false;
????????????_Count?=?0;
????????}
????????//先錄20秒語音
????????private?void?ExecRocred()
????????{
????????????while?(true)
????????????{
????????????????if?(_lyState)
????????????????{
????????????????????SoundRecord?_SoundRecord?=?new?SoundRecord();
????????????????????string?FileName?=?Application.StartupPath?+?@“\Rocred\“?+?DateTime.Now.ToString(“yyyyMMddhhmmss“)?+?“.wav“;
????????????????????_SoundRecord.SetFileName(FileName);
????????????????????_SoundRecord.RecStart();
????????????????????while?(true)
????????????????????{
????????????????????????if?(_Count?>?5)
????????????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????188??2016-05-19?10:51??WinSound\WinSound\App.config
?????文件??????????0??2016-05-19?14:57??WinSound\WinSound\bin\Debug\0462e314a6668a9684e80489c5433927\msc_sess_err.log
?????文件????????240??2016-05-19?14:57??WinSound\WinSound\bin\Debug\0462e314a6668a9684e80489c5433927\msc_sess_perf.log
?????文件?????????11??2016-05-19?14:57??WinSound\WinSound\bin\Debug\0462e314a6668a9684e80489c5433927\usr.dat
?????文件??????????0??2016-05-20?15:01??WinSound\WinSound\bin\Debug\93462b5601ef93114ba5c1c5530fd4bd\msc_sess_err.log
?????文件????????240??2016-05-20?15:01??WinSound\WinSound\bin\Debug\93462b5601ef93114ba5c1c5530fd4bd\msc_sess_perf.log
?????文件?????????11??2016-05-20?15:01??WinSound\WinSound\bin\Debug\93462b5601ef93114ba5c1c5530fd4bd\usr.dat
?????文件??????53760??2016-05-20?11:48??WinSound\WinSound\bin\Debug\AxInterop.WMPLib.dll
?????文件?????331264??2016-05-20?11:48??WinSound\WinSound\bin\Debug\Interop.WMPLib.dll
?????文件??????53248??2005-03-18?16:23??WinSound\WinSound\bin\Debug\Microsoft.DirectX.AudioVideoPlayback.dll
?????文件?????178176??2005-03-18?16:23??WinSound\WinSound\bin\Debug\Microsoft.DirectX.DirectSound.dll
?????文件?????223232??2005-03-18?16:23??WinSound\WinSound\bin\Debug\Microsoft.DirectX.dll
?????文件?????488296??2014-08-18?09:24??WinSound\WinSound\bin\Debug\msc.dll
?????文件?????283496??2014-08-18?09:24??WinSound\WinSound\bin\Debug\speex.dll
?????文件??????42496??2016-05-20?14:59??WinSound\WinSound\bin\Debug\WinSound.exe
?????文件????????188??2016-05-19?10:51??WinSound\WinSound\bin\Debug\WinSound.exe.config
?????文件??????73216??2016-05-20?14:59??WinSound\WinSound\bin\Debug\WinSound.pdb
?????文件??????11600??2016-05-20?14:27??WinSound\WinSound\bin\Debug\WinSound.vshost.exe
?????文件????????188??2016-05-19?10:51??WinSound\WinSound\bin\Debug\WinSound.vshost.exe.config
?????文件???????7254??2016-05-20?14:59??WinSound\WinSound\CommData.cs
?????文件???????7554??2016-05-20?14:57??WinSound\WinSound\CommData.Designer.cs
?????文件???????6902??2016-05-20?14:57??WinSound\WinSound\CommData.resx
?????文件???????1838??2016-05-19?14:44??WinSound\WinSound\CSpeechToText.cs
?????文件???????5817??2016-05-19?13:43??WinSound\WinSound\Form1.resx
?????文件??????33914??2006-03-07?22:46??WinSound\WinSound\Microsoft.DirectX.AudioVideoPlayback.xm
?????文件?????348085??2006-03-07?22:46??WinSound\WinSound\Microsoft.DirectX.DirectSound.xm
?????文件?????265390??2006-03-07?22:46??WinSound\WinSound\Microsoft.DirectX.xm
?????文件?????194895??2016-05-18?16:16??WinSound\WinSound\MicrosoftDirectX.zip
?????文件??????53760??2016-05-20?11:48??WinSound\WinSound\obj\x86\Debug\AxInterop.WMPLib.dll
?????文件??????10200??2016-05-20?11:48??WinSound\WinSound\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
............此處省略58個文件信息
- 上一篇:ASP.Net登錄界面及連接數據庫
- 下一篇:C#在線考試系統軟件版
評論
共有 條評論