csharp: Speech
Speech SDK 5.1
https://www.microsoft.com/en-us/download/details.aspx?id=10121
detects mobile devices and browsers http://51degrees.codeplex.com/
http://detectmobilebrowsers.com/
https://github.com/serbanghita/Mobile-Detect
Speech synthesis sample
https://code.msdn.microsoft.com/windowsapps/Speech-synthesis-sample-6e07b218
http://microsoft.github.io/windows/
Microsoft Speech Platform - Software Development Kit (SDK) (Version 11)
https://www.microsoft.com/en-us/download/details.aspx?id=27226
Microsoft Visual Studio International Pack 1.0 SR1
https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=15251
Microsoft Visual Studio International Feature Pack 2.0
https://www.microsoft.com/en-us/download/details.aspx?id=18970
http://www.codeproject.com/Articles/42354/The-Art-of-Logging (程序日志管理)
http://slf.codeplex.com/
https://github.com/net-commons
https://github.com/aspnet/Logging
http://netcommon.sourceforge.net/docs/1.2.0/reference/html/logging.html
https://github.com/apache/log4net/tree/trunk/src
https://sourceforge.net/projects/log4net/?source=navbar
http://extjspractice.codeplex.com/
http://extjsextender.codeplex.com/
http://fineui.codeplex.com/
http://extsharp.codeplex.com/
http://bocaextjs.codeplex.com/
http://extaspnet.codeplex.com/
http://helperproject.codeplex.com/
http://regsharp.codeplex.com/
http://wacvextjs.codeplex.com/
http://dough.codeplex.com/
http://blog.csdn.net/Rock870210/article/details/6068279
https://github.com/whizkidwwe1217/aspwebapiextjs
https://github.com/hogaf/Hogaf.ExtNet3.UX
Speech SDK 5.1
javascrit:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | <!-- Copyright @ 2001 Microsoft Corporation All Rights Reserved. --> < HTML > < HEAD > < META HTTP-EQUIV="Content-Type" content="text/html; charset=UTF-8"> < TITLE >TTS Demo</ TITLE > < SCRIPT LANGUAGE="JavaScript"> // Create the Sapi SpVoice object var VoiceObj = new ActiveXObject("Sapi.SpVoice"); // ChangeVoice() function: // This function sets the newly selected voice choice from the Voice // Select box on the Voice object. function ChangeVoice() { var i = parseInt( idsVoices.value ); VoiceObj.Voice = VoiceObj.GetVoices().Item(i); } // ChangeAudioOutput() function: // This function sets the newly selected audio output choice from the // Audio Output Select box on the Voice object. function ChangeAudioOutput() { var i = parseInt( idsAudioOutputs.value ); VoiceObj.AudioOutput = VoiceObj.GetAudioOutputs().Item(i); } // IncRate() function: // This function increases the speaking rate by 1 up to a maximum // of 10. function IncRate() { if( VoiceObj.Rate < 10 ) { VoiceObj.Rate = VoiceObj.Rate + 1; } } // DecRate() function: // This function decreases the speaking rate by -1 down to a minimum // of -10. function DecRate() { if( VoiceObj.Rate > -10 ) { VoiceObj.Rate = VoiceObj.Rate - 1; } } // IncVol() function: // This function increases the speaking volume by 10 up to a maximum // of 100. function IncVol() { if( VoiceObj.Volume < 100 ) { VoiceObj.Volume = VoiceObj.Volume + 10; } } // DecVol() function: // This function decreases the speaking volume by -10 down to a minimum // of 0. function DecVol() { if( VoiceObj.Volume > 9 ) { VoiceObj.Volume = VoiceObj.Volume - 10; } } // SpeakText() function: // This function gets the text from the textbox and sends it to the // Voice object's Speak() function. The value "1" for the second // parameter corresponds to the SVSFlagsAsync value in the SpeechVoiceSpeakFlags // enumerated type. function SpeakText() { if( idbSpeakText.value == "SpeakText" ) { // Speak the string in the edit box try { VoiceObj.Speak( idTextBox.value, 1 ); } catch(exception) { alert("Speak error"); } } else if( idbSpeakText.value == "Stop" ) { // Speak empty string to Stop current speaking. The value "2" for // the second parameter corresponds to the SVSFPurgeBeforeSpeak // value in the SpeechVoiceSpeakFlags enumerated type. VoiceObj.Speak( "", 2 ); } } </ SCRIPT > < SCRIPT FOR="window" EVENT="OnQuit()" LANGUAGE="JavaScript"> // Clean up voice object delete VoiceObj; </ SCRIPT > </ HEAD > < BODY > < H1 align=center>Simple TTS (DHTML)</ H1 > < H1 align=center>< FONT size=3> </ FONT > < IMG alt="" border=2 hspace=0 id=idImage src="mouthclo.bmp"> </ H1 > < H1 align=center> < TEXTAREA ID=idTextBox COLS=50 ROWS=10 WRAP=VIRTUAL>Enter text you wish spoken here</ TEXTAREA > </ H1 > < P align=center>< STRONG >< STRONG > Rate < STRONG > < INPUT id=idbIncRate name=button1 type=button onclick=IncRate() value=" + "></ STRONG > < INPUT id=idbDecRate name=button2 type=button onclick=DecRate() value=" - " style="LEFT: 237px; TOP: 292px"> </ STRONG > Volume < STRONG >< STRONG > < INPUT id=idbIncVol name=button3 onclick=IncVol() style="LEFT: 67px; TOP: 318px" type=button value=" + "> < INPUT id=idbDecVol name=button4 onclick=DecVol() type=button value=" - " style="LEFT: 134px; TOP: 377px"> </ STRONG ></ STRONG ></ STRONG ></ P > < P align=center>< STRONG >< BUTTON id=idbSpeakText onclick=SpeakText(); style="HEIGHT: 24px; LEFT: 363px; TOP: 332px; WIDTH: 178px">SpeakText</ BUTTON ></ STRONG ></ P > < P align=center>< STRONG >Voice < STRONG >Audio Output </ STRONG ></ STRONG ></ P > < P align=center> < SELECT id=idsVoices name=Voices onchange=ChangeVoice() style="FONT-FAMILY: serif; HEIGHT: 21px; WIDTH: 179px"> </ SELECT > < SELECT id=idsAudioOutputs name=AudioOutputs onchange=ChangeAudioOutput() style="HEIGHT: 22px; WIDTH: 179px"> </ SELECT > < SCRIPT LANGUAGE="JavaScript"> // Code in the BODY of the webpage is used to initialize controls and // to handle SAPI events /***** Initializer code *****/ InitializeControls(); function InitializeControls() { // Initialize the Voices and AudioOutput Select boxes var VoicesToken = VoiceObj.GetVoices(); var AudioOutputsToken = VoiceObj.GetAudioOutputs(); // Add correct strings to Voice Select box for( var i=0; i< VoicesToken.Count ; i++ ) { var oOption = document.createElement("OPTION"); idsVoices.options.add(oOption); oOption.innerText = VoicesToken.Item(i).GetDescription(); oOption.value = i; } // Add correct strings to Audio Output Select box for( var i=0; i<AudioOutputsToken.Count; i++ ) { var oOption = document.createElement("OPTION"); idsAudioOutputs.options.add(oOption); oOption.innerText = AudioOutputsToken.Item(i).GetDescription(); oOption.value = i; } } /***** Event handling code *****/ // These functions are used to handle the SAPI events // Handle StartStream event function VoiceObj::StartStream() { idbSpeakText.value = "Stop"; } // Handle EndStream event function VoiceObj::EndStream() { idbSpeakText.value = "SpeakText"; idImage.src = "mouthclo.bmp"; } // Handle Viseme event function VoiceObj::Viseme(StreamNum, StreamPos, Duration, VisemeType, Feature, VisemeId) { // Map the VisemeId to the appropriate .bmp if( VisemeId == 15 || VisemeId == 17 || VisemeId == 18 || VisemeId ==21 ) { idImage.src = "mouthop1.bmp"; } else if( VisemeId == 14 || VisemeId == 16 || VisemeId == 19 || VisemeId == 20 ) { idImage.src = "mouthop2.bmp"; } else if( VisemeId == 4 || VisemeId == 6 || VisemeId == 9 || VisemeId == 12 ) { idImage.src = "mouthop3.bmp"; } else if( VisemeId == 1 || VisemeId == 2 || VisemeId == 3 || VisemeId == 11 ) { idImage.src = "mouthop4.bmp"; } else if( VisemeId == 7 || VisemeId == 8 ) { idImage.src = "mouthnar.bmp"; } else if( VisemeId == 5 || VisemeId == 10 || VisemeId == 13 ) { idImage.src = "mouthmed.bmp"; } else { idImage.src = "mouthclo.bmp"; } } </SCRIPT> < STRONG > < HR ></ STRONG > < P ></ P > </ BODY > </ HTML > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | private void btnSpeak_Click( object sender, System.EventArgs e) { //Create a TTS voice and speak. try { SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync; SpVoice Voice = new SpVoice(); if (chkSaveToWavFile.Checked) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav" ; sfd.Title = "Save to a wave file" ; 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 ); Voice.AudioOutputStream = SpFileStream; Voice.Speak(txtSpeakText.Text, SpFlags); Voice.WaitUntilDone(Timeout.Infinite); SpFileStream.Close(); } } else { Voice.Speak(txtSpeakText.Text, SpFlags); } } catch (Exception error) { MessageBox.Show( "Speak error" , "SimpleTTS" , MessageBoxButtons.OK, MessageBoxIcon.Error); } } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
2015-07-13 csharp: Data binding in WPF DataGrid control
2010-07-13 CSS Vertical Text