C#如何开发语音朗读,最好有例子

尹成学院 2009-06-25 09:42:06
C#如何开发语音朗读,最好有例子
...全文
232 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
evaa006 2009-06-25
  • 打赏
  • 举报
回复
晕,倒粪贴啊,版主出来封ID
尹成 2009-06-25
  • 打赏
  • 举报
回复
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Synthesis;
using System.Speech;


namespace yincheng01@163.com
{
public class SpeechSpeak
{
public SpeechSynthesizer synth;
public SpeechSpeak()
{

synth = new SpeechSynthesizer();

}
// public SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;

public SpeechSpeak(int m, int n)
{

//使用 synth 设置朗读音量 [范围 0 ~ 100]
synth.Volume = m;
//使用 synth 设置朗读频率 [范围 -10 ~ 10]
synth.Rate = n;
}


public void SpeakChina(string ggg)
{

//SpVoice Voice = new SpVoice();
synth.SelectVoice("Microsoft Lili");


//Voice.Speak(ggg, SpFlags);
synth.SpeakAsync(ggg);



//String speechPeople = synth.Voice;
//使用 synth 设置朗读音量 [范围 0 ~ 100]
// synth.Volume = 80;
//使用 synth 设置朗读频率 [范围 -10 ~ 10]
// synth.Rate = 0;

//使用synth 合成 wav 音频文件:
//synth.SetOutputToWaveFile(string path);

}



public void SpeakEnglish(string ggg)
{

//SpVoice Voice = new SpVoice();
synth.SelectVoice("Microsoft Anna");

synth.Speak(ggg);


}
public int m
{
get
{
return synth.Volume;

}
set
{

synth.Volume = value;
}



}


public int n
{
get
{
return synth.Rate;

}
set
{

synth.Rate = value;
}



}






public void Pause()
{

synth.Pause();


}
public void Goon()
{

synth.Resume();


}
public void Cancel()
{


synth.SpeakAsyncCancelAll();
}
}
}


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yincheng01/archive/2009/01/12/3762646.aspx
evaa006 2009-06-25
  • 打赏
  • 举报
回复
ding

17,740

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧