asp.NetリファレンスSystem.Speech音声メッセージの実装

2707 ワード

using System;
using System.Speech.Synthesis;

namespace testvoice
{
    class Program
    {
        static void Main(string[] args)
        {
            SpeechSynthesizer synth = new SpeechSynthesizer();

            //            Voice   
            string voicestring = "";

            foreach (InstalledVoice iv in synth.GetInstalledVoices())
            {
                voicestring += iv.VoiceInfo.Name + ",";
            }
            //voicestring   Microsoft Lili,Microsoft Anna
            synth.Volume = 100;
            synth.Rate = -5;
            //  Voice name        Voice
            //synth.SelectVoice("Microsoft Anna");//
            synth.SelectVoice("Microsoft Lili");//     
            //          
            synth.Speak("  ");
            Console.Read();
        }
    }
}

 
転載先:https://www.cnblogs.com/xuwendong/p/9719753.html