C#?????????????wav??MP3???
???????????? ???????[ 2014/5/30 14:21:39 ] ????????C# net
???????????????????????????????£?
privateSpeechSynthesizersynth=null;//???????
///<summary>
///???????SpeechSynthesizer????
///</summary>
///<returns></returns>
privateSpeechSynthesizerGetSpeechSynthesizerInstance()
{
if(synth==null)
{
synth=newSpeechSynthesizer();
}
returnsynth;
}
///<summary>
///?????????????
///</summary>
///<returns></returns>
privateVoiceClassGetVoiceClass()
{
VoiceClasssetViceClass=newVoiceClass();
setViceClass.VoiceName=cboTokens.Text;
setViceClass.Rate=int.Parse(cboSpeed.Text);
setViceClass.Volume=tbVoice.Value;
setViceClass.VoiceText=txtInput.Text;
returnsetViceClass;
}
///<summary>
///????
///</summary>
///<paramname="sender"></param>
///<paramname="e"></param>
privatevoidbtnGo_Click(objectsender??EventArgse)
{
if(IsVaild())
{
VoiceClasssetViceClass=GetVoiceClass();//VoiceClass????????????????????????????????????????????
Threadthread=newThread(RingVoice);
thread.Start(setViceClass);
}
}
///<summary>
///???????????????
///</summary>
///<paramname="VoiceObject"></param>
publicvoidRingVoice(objectVoiceObject)
{
try
{
VoiceClassvoiceClass=(VoiceClass)VoiceObject;
synth=GetSpeechSynthesizerInstance();
synth.SelectVoice(voiceClass.VoiceName);
synth.Rate=voiceClass.Rate;
synth.Volume=voiceClass.Volume;
synth.SpeakAsync(voiceClass.VoiceText);
}
catch(Exceptioner)
{
MessageBox.Show(er.ToString()??"???"??MessageBoxButtons.OK??MessageBoxIcon.Error);
}
}
///<summary>
///????
///</summary>
///<paramname="sender"></param>
///<paramname="e"></param>
privatevoidbtnSave_Click(objectsender??EventArgse)
{
if(IsVaild())
{
synth=GetSpeechSynthesizerInstance();
VoiceClassvoiceClass=GetVoiceClass();
synth.SelectVoice(voiceClass.VoiceName);
synth.Rate=voiceClass.Rate;
synth.Volume=voiceClass.Volume;
SaveFileDialogsaveFileDialog=newSaveFileDialog();
saveFileDialog.Title="???????";
saveFileDialog.Filter="*.wav|*.wav|*.mp3|*.mp3";
saveFileDialog.InitialDirectory=Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
DialogResultsaveDialog=saveFileDialog.ShowDialog();
try
{
if(saveDialog==System.Windows.Forms.DialogResult.OK)
{
synth.SetOutputToWaveFile(saveFileDialog.FileName);
synth.Speak(voiceClass.VoiceText);
synth.SetOutputToNull();
System.Diagnostics.Process.Start("Explorer.exe"??string.Format(@"/select??{0}"??saveFileDialog.FileName));//??wav??????????
}
}
catch(Exceptioner)
{
MessageBox.Show(er.ToString()??"???"??MessageBoxButtons.OK??MessageBoxIcon.Error);
}
}
}
///<summary>
///????
///</summary>
///<paramname="sender"></param>
///<paramname="e"></param>
privatevoidbtnContinum_Click(objectsender??EventArgse)
{
synth.Resume();
}
///<summary>
///???
///</summary>
///<paramname="sender"></param>
///<paramname="e"></param>
privatevoidbtnStop_Click(objectsender??EventArgse)
{
synth.Pause();
}
|
?????и????????????????????????????????μ?12345???????????????12345??????????1??2?3??4??塣????????????У??????鷳???????????лл??
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???????C#?е?StringC# Socket???????????????????C#?????????????????????????C#???????C#????????????Log4net??????δ????C#?????????????C#?????????????????C#???????????????C#????????????????C#7 ?е?Tuple??????C#??TypeScript - GeneratorC# ?????????細(xì)??????????C#?е???н???C#??MySQL?????????μ??Ч?????д??C#????C++??dll???C#??VS2010????е??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????