zoukankan      html  css  js  c++  java
  • c# 语音(二)文字生成WAV文件

     private void CreateWAVFile(string text)
            {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter = "所有文件 (*.*)|*.*|WAV 格式文件 (*.wav)|*.wav";
                sfd.Title = "保存到 wave 文件";
                sfd.FilterIndex = 2;
                sfd.RestoreDirectory = true;
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    SpeechStreamFileMode SpFileMode = SpeechStreamFileMode.SSFMCreateForWrite;
                    SpFileStream SpFileStream = new SpFileStream();
                    SpFileStream.Open(sfd.FileName, SpFileMode, false);
                    speech.AudioOutputStream = SpFileStream;
                    speech.Rate = -1;
                    speech.Volume = volume;
                    speech.Speak(text, SpeechVoiceSpeakFlags.SVSFlagsAsync);
                    speech.WaitUntilDone(Timeout.Infinite);
                    SpFileStream.Close();
                }
            }

  • 相关阅读:
    顺序容器2(用法)
    运算符重载
    IO相关3(string流)
    IO相关2(文件输入输出)
    C语言--指针
    Java---匿名类
    Andriod开发 --插件安装、环境配置、问题集锦
    ubuntu--vim 技巧
    ubuntu--命令大全
    各浏览器userAgent汇总
  • 原文地址:https://www.cnblogs.com/chengjunwei/p/3406806.html
Copyright © 2011-2022 走看看