• 大小: 961KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: C#
  • 标签: C#  语音文字  

资源简介

自己写的。语音识别,语音合成,包含录音文件。能运行,提供源码大家共同学习谢谢

资源截图

代码片段和文件信息

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.xml

     文件     348085  2006-03-07 22:46  WinSound\WinSound\Microsoft.DirectX.DirectSound.xml

     文件     265390  2006-03-07 22:46  WinSound\WinSound\Microsoft.DirectX.xml

     文件     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个文件信息

评论

共有 条评论