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

  • 相关阅读:
    SpringMVC的 @RestController和@Controller 区别
    Explain的使用
    spring定时任务详解
    C++提高---模板
    小练习--感悟点
    06文件操作
    05多态
    04继承
    Mismatch between array dtype ('<U18') and format specifier ('%.18e')
    01基础
  • 原文地址:https://www.cnblogs.com/chengjunwei/p/3406806.html
Copyright © 2011-2022 走看看