C#语音合成-Win7平台

最近因为一个项目需要用到语音合成,使用的平台是win7+Vs2013,以前未曾接触过这方面的资料,网上找了半天,发现总是那几篇被转来转去,而且都是N年以前的东西,不实用。综合网上的资料,利用win7自带的语音引擎,发现实现起来其实很简单。

新建一个控制台,添加引用:System.Speech,合成代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Speech.Synthesis;
using System.Speech;


namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string Sptext = "SAPI SDK是微软公司免费提供的语音应用开发工具包"; 

SpeechSynthesizer speaker = new SpeechSynthesizer();

speaker.Rate = 0;

speaker.Volume = 100;

speaker.Speak(Sptext);
 }

     }

}

 

因为是用系统自带的,所以只有女声,可以做到中英文合成,下步再研究研究如何实现识别。

 

 

你可能感兴趣的:(C#)