分享

.Net3.0实现文本语音朗读的方法

 nxhujiee 2010-04-15
.Net3.0实现文本语音朗读的方法
作者:VB-Tips    来源:VB-Tips     更新时间:2009-10-20

.Net3.0实现文本语音朗读的方法

The .Net Framework 3.0 has added some managed Text to Speech functions.  For this example you to add a reference to System.Speech.  I have placed a Listbox (to show the available voices on your machine), textbox, and button on a form.  When you click on the button your computer will say the text in your textbox in the voice selected in the listbox.

Imports System.Speech.Synthesis

Public Class Form1

    Private Sub btnSay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSay.Click
        Dim spk As New SpeechSynthesizer
        spk.SelectVoice(lstVoice.SelectedItem.ToString)
        spk.Speak(txtSay.Text)
    End Sub  '更多.net源码和实例,来自[乐 博 网 www.]

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim spk As New SpeechSynthesizer
        For Each voice As InstalledVoice In spk.GetInstalledVoices
            lstVoice.Items.Add(voice.VoiceInfo.Name)
        Next
        lstVoice.SelectedIndex = 0
        txtSay.Text = "Hello World!"
    End Sub
End Class

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多