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();
                }
            }

  • 相关阅读:
    【leetcode】1009. 十进制整数的反码
    【leetcode】1446. 连续字符
    __getattr__在python2.x与python3.x中的区别及其对属性截取与代理类的影响
    Python 中异常嵌套
    python 变量搜寻顺序法则LEGB之E注意事项
    %%的一个应用
    python中__str__与__repr__
    052-180
    052-177
    052-176
  • 原文地址:https://www.cnblogs.com/chengjunwei/p/3406806.html
Copyright © 2011-2022 走看看