1. 程式人生 > >中文文字到語音朗讀.NET3.5 For Windows 和Windows Mobile

中文文字到語音朗讀.NET3.5 For Windows 和Windows Mobile

非凡科技簡單語音朗讀二次開發包

應用說明

非凡科技簡單語音朗讀二次開發包是一種最為簡單的語音朗讀解決方案,不需要任何的第三方TTS引擎支援(如微軟)而可以獨立釋出的語音朗讀開發程式。

非凡科技簡單語音朗讀二次開發包僅適用於比較小型且簡單的應用場合,並不適合複雜場合,對於要求朗讀連貫的應用不建議使用。

非凡科技簡單語音朗讀二次開發包占據儲存空間為26MB,朗讀語音為女聲中文。

朗讀語音:女聲中文(漢字、基本標點符號、數字)

容錯方式:未識別語音將被忽略

適用開發語言:.NET3.5版本及以上

For Windows 平臺

名稱空間:SantookTTSLibForNET35

工作類名:ClassSpeech

方法

方法名

引數

描述

New()

LibPath As String

初始化語音朗讀字典,如果Lib資料夾放置於當前應用程式執行根目錄下,則LibPath為當前程式的啟動資料夾路徑

ReadTextToSpeech

Text As String

朗讀引數Text所指定的內容(包括識別中文漢字、阿拉伯數字、基本標點符號),該方法使用當前UI執行緒進行朗讀,要進行較長的朗讀,請使用多執行緒。

屬性

屬性名

型別

描述

LibDectory

Readonly String

當前字典工作目錄,只讀

VB.NET示例程式碼:

Public Class Form1

    Private tts As SantookTTSLibForNET35.ClassSpeech

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        tts.ReadTextToSpeech(Me.RichTextBox1.Text)

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal

 e As System.EventArgs) Handles MyBase.Load

        tts = New SantookTTSLibForNET35.ClassSpeech(New IO.FileInfo(Application.ExecutablePath).DirectoryName)

    End Sub

End Class

C#示例程式碼:

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;

namespace 非凡科技SampleTTS二次開發包演示程式碼CSharp

{

    public partial class Form1 : Form

    {

        private SantookTTSLibForNET35.ClassSpeech TTS;

        public Form1()

        {

            InitializeComponent();

        }

        private void button1_Click(object sender, EventArgs e)

        {

            TTS.ReadTextToSpeech(this.richTextBox1.Text);

        }

        private void Form1_Load(object sender, EventArgs e)

        {

            TTS = new SantookTTSLibForNET35.ClassSpeech(new System.IO.FileInfo(Application.ExecutablePath).DirectoryName);

        }

    }

}

For Windows Mobile 平臺

名稱空間:SantookTTSLibraryForWM

工作類名:SpeechTextForWM

方法

方法名

引數

描述

New()

LibPath As String

初始化語音朗讀字典,如果Lib資料夾放置於當前應用程式執行根目錄下,則LibPath為當前程式的啟動資料夾路徑

ReadTextToSpeech

Text As String

朗讀引數Text所指定的內容(包括識別中文漢字、阿拉伯數字、基本標點符號),該方法使用當前UI執行緒進行朗讀,要進行較長的朗讀,請使用多執行緒。

屬性

屬性名

型別

描述

LibDectory

Readonly String

當前字典工作目錄,只讀

VB.NET For Windows Mobile示例程式碼 :

Public Class Form1

    Private TTS As SantookTTSLibraryForWM.SpeechTextForWM

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        TTS.ReadTextToSpeech(Me.TextBox1.Text)

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        TTS = New SantookTTSLibraryForWM.SpeechTextForWM(IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase))

    End Sub

End Class

C# For Windows Mobile 示例程式碼:

using System;

using System.Linq;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace 非凡TTS開發包CSharpForWM

{

    public partial class Form1 : Form

    {

        private SantookTTSLibraryForWM.SpeechTextForWM TTS;

        public Form1()

        {

            InitializeComponent();

        }

        private void Form1_Load(object sender, EventArgs e)

        {

            TTS = new SantookTTSLibraryForWM.SpeechTextForWM(IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase));

        }

        private void button1_Click(object sender, EventArgs e)

        {

            TTS.ReadTextToSpeech(this.textBox1.Text);

        }

    }

}

軟體開發:宋曉。

                                                                                                                             開發包請到我的下載中下載