国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

簡單C#文字轉語音

2019-11-14 16:27:04
字體:
來源:轉載
供稿:網友

跟著微軟走妥妥的,C#文字轉語音有很多參數我就不說了,畢竟我也是初學者。跟大家分享最簡單的方法,要好的效果得自己琢磨嘍;

先添加引用System.Speech程序集;

using System;using System.Speech.Synthesis;namespace Consoleapplication2{    class PRogram    {        static void Main(string[] args)        {                                     SpeechSynthesizer hello = new SpeechSynthesizer();            string str = "請輸入您的名字";            hello.Speak(str);  //Speak(string),Speak加上字符串類型的參數            Console.ReadKey();         }         

我個人覺得有些時候就是要直接講重點,要的就是這種簡單粗暴,呵呵

雖是簡單的代碼,多段疊加就不得了啊,個人覺得編程就是要用最少的代碼干最多的事。

簡單的代碼加上不同的想法就有不同的效果

using System;using System.Speech.Synthesis;namespace ConsoleApplication2{    class Program    {        static void Main(string[] args)        {                         /*下面這個程序不支持英文,我剛接觸,英文的我還不懂,呵呵*/            SpeechSynthesizer hello = new SpeechSynthesizer();            string str = "請輸入您的名字";            Console.WriteLine(str);            hello.Speak(str);            string input = Console.ReadLine();            Console.WriteLine ("你好,"+input);            hello.Speak("你好,"+input);            str = "我是您的助手,很高興認識你";            Console.WriteLine(str);            hello.Speak(str);              Console.ReadKey();         }         }}

 這是我第一次寫博文,寫得不好的地方請多多包涵,若有錯的地方歡迎指正,謝謝!

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 怀化市| 腾冲县| 龙口市| 玛多县| 巴南区| 兰西县| 永兴县| 金秀| 平陆县| 绥化市| 天台县| 博爱县| 肥城市| 顺昌县| 衡山县| 通榆县| 邢台市| 高阳县| 新邵县| 千阳县| 临清市| 石泉县| 秦安县| 老河口市| 桃园市| 盱眙县| 辉县市| 宁海县| 寿阳县| 句容市| 凤凰县| 梅州市| 惠东县| 齐河县| 镇康县| 济南市| 临江市| 鄢陵县| 监利县| 新巴尔虎右旗| 卓资县|