DotNetSpeech.dll是5.1.0.0版本
现在只能男声读出英文内容的txt文件 要如何修改才能用女声读出中文内容
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.InteropServices;
using DotNetSpeech;
using System.Speech.Synthesis;
using System.Diagnostics;
namespace ceshifrom
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void button1_Click(object sender, EventArgs e)//朗读文件
        {
            if (textBox1.Text.Trim() != "")
            {
                try
                {
                    StreamReader sr = new StreamReader(textBox1.Text, Encoding.GetEncoding("gb2312"));
                    string content = sr.ReadToEnd();
                    sr.Close();//关闭读流                    DotNetSpeech.SpeechVoiceSpeakFlags SSF = DotNetSpeech.SpeechVoiceSpeakFlags.SVSFlagsAsync;
                    DotNetSpeech.SpVoice vo = new SpVoice();//Class
                    vo.Speak(content, SSF);
                }
                catch (System.Exception ec)
                {
                    MessageBox.Show(ec.ToString(), "SpeechApp", MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }
            else
            {
                button2.Focus();
            }        }        private void button2_Click(object sender, EventArgs e)//选择文件
        {
            System.Windows.Forms.OpenFileDialog fg = new OpenFileDialog();
            fg.Filter = "txt files (*.txt)|*.txt|xml files(*.xml)|*.xml";
            //fg.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav";
            fg.ShowDialog();
            if (fg.ShowDialog() == DialogResult.OK)
            {
                string fName = fg.FileName;
                textBox1.Text = fName;               
            }            
            fg.Dispose();
        }
    }
}

解决方案 »

  1.   

    没用过,搜出来的结果:
    http://kingwei.programfan.com/club/showpost.asp?id=3583
      

  2.   

    安装SpeechSDK51和 SpeechSDK51LangPack
    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5e86ec97-40a7-453f-b0ee-6583171b4530&displaylang=en
    在vo.Speak(content, SSF);前,设置属性
    vo.Voice = voice.GetVoices(string.Empty, string.Empty).Item(3);SpeechSDK51LangPack支持中文发音,对应Item中参数3应该是个女音
    我用speechlib是这样的,dotnetspeech中的不知道是不是一样