zoukankan      html  css  js  c++  java
  • C# Speech

      private void Button_Click(object sender, RoutedEventArgs e)
            {
                SpeechVideo_Read(2, 100, "You came to me Like the dawn through the night Just shining like the sun.");
            }

            public void SpeechVideo_Read(int rate, int volume, string speektext)  //读
            {
                speech.Rate = rate;
                speech.Volume = volume;
                speech.SpeakAsync(speektext);
            }

      public void SpeechVideo_Record(int rate, int volume, string recordtext)  //录音
            {
                SpeechSynthesizer speech = new SpeechSynthesizer();
                speech.Rate = rate;
                speech.Volume = volume;
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter = "文本文件(*.wav)|*.wav|所有文件(*.*)|*.*";
                //设置默认文件类型显示顺序
                sfd.FilterIndex = 1;
                //保存对话框是否记忆上次打开的目录
                sfd.RestoreDirectory = true;
                if (sfd.ShowDialog()== System.Windows.Forms.DialogResult.OK)
                {
                    string localfilepath = sfd.FileName.ToString();
                    speech.SetOutputToWaveFile(localfilepath);
                    speech.Speak(recordtext);
                    speech.SetOutputToDefaultAudioDevice();
                    System.Windows.MessageBox.Show("完成录音!", "提示");
                }
            }

  • 相关阅读:
    全面整理的C++面试题
    在chrome下安装Proxy SwitchySharp插件
    VC中获取窗体句柄的各种方法
    炙手可热的12款站点模板推荐
    _blank开新窗体不符合标准?
    欢迎大家来我的小站
    白话经典算法系列之中的一个 冒泡排序的三种实现
    CRF++使用小结(转)
    智能点餐系统开发纪实2-----系统总体结构和业务流程
    Windows Mobile 6.0 SDK和中文模拟器下载
  • 原文地址:https://www.cnblogs.com/yuanchao/p/13492157.html
Copyright © 2011-2022 走看看