当前位置: 首页>>代码示例>>C#>>正文


C# SpeechSynthesizer.SelectVoiceByHints方法代码示例

本文整理汇总了C#中SpeechSynthesizer.SelectVoiceByHints方法的典型用法代码示例。如果您正苦于以下问题:C# SpeechSynthesizer.SelectVoiceByHints方法的具体用法?C# SpeechSynthesizer.SelectVoiceByHints怎么用?C# SpeechSynthesizer.SelectVoiceByHints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SpeechSynthesizer的用法示例。


在下文中一共展示了SpeechSynthesizer.SelectVoiceByHints方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: speak

 public void speak(string word)
 {
     try
     {
         SpeechSynthesizer voice = new SpeechSynthesizer();
         switch (cmbbox.SelectedIndex)
         {
             case 0:
                 voice.SelectVoiceByHints(VoiceGender.NotSet);
                 break;
             case 1:
                 voice.SelectVoiceByHints(VoiceGender.Male);
                 break;
             case 2:
                 voice.SelectVoiceByHints(VoiceGender.Female);
                 break;
             case 3:
                 voice.SelectVoiceByHints(VoiceGender.Neutral);
                 break;
             default:
                 voice.SelectVoiceByHints(VoiceGender.NotSet);
                 break;
         }
         voice.SpeakAsync(word);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
开发者ID:AhmedShaabanElhdad,项目名称:Vocabulary,代码行数:30,代码来源:Form1.cs

示例2: BuildSynth

        private SpeechSynthesizer BuildSynth(string gender)
        {
            var synth = new SpeechSynthesizer();
            if (!string.IsNullOrEmpty(gender) && gender.ToUpper() == "BOY")
            {
                synth.SelectVoiceByHints(VoiceGender.Male);
            }
            else
            {
                synth.SelectVoiceByHints(VoiceGender.Female);
            }

            return synth;
        }
开发者ID:kurtdevocht,项目名称:ScratchCanTalk,代码行数:14,代码来源:ScratchController.cs

示例3: SpeechOutput

 private SpeechOutput()
 {
     _synth = new SpeechSynthesizer();  
     _synth.SelectVoiceByHints(VoiceGender.Female);
     _synth.Rate = 1;
     _synth.Volume = 90; 
 }
开发者ID:sic2,项目名称:HaptiQ,代码行数:7,代码来源:SpeechOutput.cs

示例4: Voice

        // read text
        private static void Voice(string toSpeak)
        {
            SpeechSynthesizer synth = new SpeechSynthesizer();

            synth.SelectVoiceByHints(VoiceGender.Female);
            synth.Rate = 1;
            synth.Speak(toSpeak);
        }
开发者ID:jekrch,项目名称:ClassWork,代码行数:9,代码来源:Synth.cs

示例5: Speech

 public void Speech(String source)
 {
     SpeechSynthesizer speaker = new SpeechSynthesizer();
     speaker.SelectVoiceByHints(VoiceGender.Female);
     speaker.Volume = 100;
     speaker.Rate = 0;
     speaker.Speak(source);
 }
开发者ID:pthdnq,项目名称:csharp-project-nduang,代码行数:8,代码来源:frmLookUp.cs

示例6: Speakthread

 private void Speakthread(object text)
 {
     SpeechSynthesizer speaker = new SpeechSynthesizer();
     speaker.Rate = -3;
     speaker.Volume = 100;
     speaker.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Child);
     speaker.Speak((string)text);
 }
开发者ID:AtVirus,项目名称:DarkAgent,代码行数:8,代码来源:Talker.cs

示例7: Tts

        /*
         * Text to Speech
         */
        public Tts()
        {
            //create speech synthesizer
            tts = new SpeechSynthesizer();
            tts.SetOutputToDefaultAudioDevice();

            //set voice
            tts.SelectVoiceByHints(VoiceGender.NotSet, VoiceAge.NotSet, 0, new System.Globalization.CultureInfo("pt-PT"));
        }
开发者ID:Felgueiras,项目名称:IM-Calculator,代码行数:12,代码来源:Tts.cs

示例8: Form1

 public Form1()
 {
     InitializeComponent();
     speaker = new SpeechSynthesizer();
     speaker.Rate = 1;
     speaker.Volume = 100;
     speaker.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);
     initialize();
 }
开发者ID:vizual54,项目名称:SynthesizeForTaranis,代码行数:9,代码来源:Form1.cs

示例9: Text2Speech

        public Text2Speech()
        {
            synthesizer = new SpeechSynthesizer();

            synthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Child);

            synthesizer.Rate = 0;

            AllVoices = new List<VoiceInfo>();
        }
开发者ID:7788wangzi,项目名称:TTSWinForm,代码行数:10,代码来源:Text2Speech.cs

示例10: Main

 static void Main(string[] args)
 {
     Console.WriteLine("Enter text to speak:");
     string TextToSpeak = Console.ReadLine(); 
     SpeechSynthesizer ss = new SpeechSynthesizer();
     ss.Volume = 100; //1 to 100
     ss.Rate = -3; // -10 to +10 
     ss.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Child);
     ss.SpeakAsync(TextToSpeak); 
     Console.Read();
 }
开发者ID:ananth039,项目名称:Anantha-Kumar-.net-Practice-programs,代码行数:11,代码来源:Program.cs

示例11: Play

 public void Play()
 {
     using (SpeechSynthesizer synth = new SpeechSynthesizer())
     {
         synth.SelectVoiceByHints(VoiceGender, VoiceAge, VoicePosition, new CultureInfo(CultureInfo));
         synth.SetOutputToDefaultAudioDevice();
         synth.Volume = Volume;
         synth.Rate = Rate;
         synth.Speak(Text);
     }
 }
开发者ID:neowutran,项目名称:ShinraMeter,代码行数:11,代码来源:TextToSpeech.cs

示例12: Server

    public Server()
    {
        Form = new CustomPerPixelAlphaForm();
        FormSetProperties();
        FormDock();
        Form.Show();

        var clientBuildDirectory = Environment.CurrentDirectory + "\\..\\..\\..\\..\\..\\Reflecta.Client\\bin";
        var clientStartInfo = new ProcessStartInfo
        {
            FileName = clientBuildDirectory + "\\Client.exe",
            WorkingDirectory = clientBuildDirectory,
            WindowStyle = ProcessWindowStyle.Minimized
        };
        Client = Process.Start(clientStartInfo);

        OpenPipes();

        SpeechSynthesizer = new SpeechSynthesizer();
        SpeechSynthesizer.SelectVoiceByHints(VoiceGender.Female);
        SpeechSynthesizer.SpeakStarted += SpeechSynthesizer_SpeakStarted;
        SpeechSynthesizer.VisemeReached += SpeechSynthesizer_VisemeReached;
        SpeechSynthesizer.SpeakCompleted += SpeechSynthesizer_SpeakCompleted;

        SpeechRecognitionEngine = new SpeechRecognitionEngine();
        SpeechRecognitionEngine.UnloadAllGrammars();
        SpeechRecognitionEngine.LoadGrammar(new Grammar(new GrammarBuilder(KnownCommands)));
        SpeechRecognitionEngine.SpeechRecognized += SpeechRecognitionEngine_SpeechRecognized;
        SpeechRecognitionEngine.SetInputToDefaultAudioDevice();
        SpeechRecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);

        KinectSensor = KinectSensor.GetDefault();
        KinectSensor.Open();

        BodyFrameSource = KinectSensor.BodyFrameSource;
        BodyFrameReader = BodyFrameSource.OpenReader();
        BodyFrameReader.FrameArrived += BodyFrameReader_FrameArrived;
        Bodies = null;
        BodyDESP = new DESPQuaternion[(int) MoCapKinectBone.Count];
        for (var i = 0; i < (int) MoCapKinectBone.Count; i++)
            BodyDESP[i] = new DESPQuaternion();

        HighDefinitionFaceFrameSource = new HighDefinitionFaceFrameSource(KinectSensor);
        HighDefinitionFaceFrameSource.TrackingQuality = FaceAlignmentQuality.High;
        HighDefinitionFaceFrameReader = HighDefinitionFaceFrameSource.OpenReader();
        HighDefinitionFaceFrameReader.FrameArrived += HighDefinitionFaceFrameReader_FrameArrived;
        FaceAlignment = new FaceAlignment();

        FaceDESP = new DESPQuaternion();
        FaceExpressionDESP = new DESPFloat[(int) MoCapKinectFacialExpression.Count];
        for (var i = 0; i < (int) MoCapKinectFacialExpression.Count; i++)
            FaceExpressionDESP[i] = new DESPFloat();
    }
开发者ID:Zerseu,项目名称:Reflecta,代码行数:53,代码来源:Server.cs

示例13: Speaker

        //static constructor of the Class, which initialises the SpeechSynthesizer , and registers the several events
        static Speaker()
        {
            mainSynthesizer=new SpeechSynthesizer();
            mainSynthesizer.SelectVoiceByHints(DataStore.CurrentUser.SynthesizerVoiceGender);
            mainSynthesizer.SetOutputToDefaultAudioDevice();

            DataStore.VoiceGenderChanged += DataStore_VoiceGenderChanged;                       //DataStore's VoiceGenderChanged event which occurs when the gender of the TTS engine has changed
            MainWindow.VolumeChanged += MainWindow_VolumeChanged;                               //MainWindow VolumeChanged event which occurs when Volume of the TTS engine changes
            MainWindow.RateChanged += MainWindow_RateChanged;                                   //MainWindow RateChanged event which occurs when Synthesis Rate of the TTS engine changes
            //mainSynthesizer.SpeakStarted += MainSynthesizer_SpeakStarted;
            //mainSynthesizer.SpeakCompleted += MainSynthesizer_SpeakCompleted;
        }
开发者ID:SarthakYadav,项目名称:Project-Voix,代码行数:13,代码来源:Speaker.cs

示例14: VocalSynthesis

        public static void VocalSynthesis(string text, string culture, string filename, string voice)
        {
            SpeechSynthesizer synth = new SpeechSynthesizer();

            synth.SelectVoiceByHints(VoiceGender.Neutral, VoiceAge.NotSet, 1, new CultureInfo(culture));

            if (!string.IsNullOrEmpty(filename))
                synth.SetOutputToWaveFile(filename);
            if (!string.IsNullOrEmpty(voice))
                synth.SelectVoice(voice);

            synth.Speak(text);
        }
开发者ID:vincentCGI,项目名称:ensae_teaching_cs,代码行数:13,代码来源:Speech.cs

示例15: Speak

        public static void Speak(string message)
        {
            // Initialize a new instance of the SpeechSynthesizer.
            using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {
                synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);

                // Configure the audio output. 
                synth.SetOutputToDefaultAudioDevice();

                // Speak a string synchronously.
                synth.Speak(message);
            }
        }
开发者ID:IrisCaffin,项目名称:13-Hackaton,代码行数:14,代码来源:SpeechService.cs


注:本文中的SpeechSynthesizer.SelectVoiceByHints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。