zoukankan      html  css  js  c++  java
  • SuperRuntimeLibrary.TextVoice 发布,支持文本到语音 文本到.wav

    srltvdemo.rar

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using SuperRuntimeLibrary.TextVoice;//引用类库

    namespace WindowsFormsApplication1
    {
        public partial class frmMain : Form
        {
            public frmMain()
            {
                InitializeComponent();
            }
            TextToVoice stv = new TextToVoice();//新建一个文本到语言的对象
            private void button1_Click(object sender, EventArgs e)
            {
                stv.Speak(textBox1.Text);//点击按钮一直接朗读该文本
            }

            private void button2_Click(object sender, EventArgs e)
            {
                stv.SpeakSpelling(textBox2.Text);//朗读文本框2中的拼音,必须是正确而且存在的拼音,且带声调
            }

            private void Form1_Load(object sender, EventArgs e)
            {
                stv.Speaking += new TextToVoice.SpeakingEventHandler(stv_Speaking);//委托朗读进度,可以通过此来反馈当前正在朗读的内容,也可以取消。
            }

            void stv_Speaking(string txtChr, ref bool Cancel)
            {
                label3.Text = string.Format("正在朗读【{0}】", txtChr);//显示朗读内容,Cancel 如果设置为否,则退出朗读。
            }

            private void button3_Click(object sender, EventArgs e)
            {
                TextToWave ttw = new TextToWave();//新建一个文本到wav的对象
                 SaveFileDialog sfd=new SaveFileDialog();//新建一个对话框
                 sfd.Filter = "音频文件(*.wav)|*.wav|全部文件(*.*)|*.*";
                 sfd.DefaultExt ="wav";
                if  (DialogResult.OK ==  sfd.ShowDialog(this ))//打开对话框
                {
                    ttw.Speak(this.textBox1.Text , sfd.FileName );//把该文本直接转换为文件。 可以用播放器来播放。
                }
            }
        }
    }

  • 相关阅读:
    Java日期时间API系列1-----Jdk7及以前的日期时间类
    Redis设置密码,保护数据安全
    Java SE 8 并发增强
    Java8并发教程:Threads和Executors
    MySQL5.7增量备份恢复全实战
    HashSet HashMap 源码阅读笔记
    操作系统知识点
    Window批处理命令
    JS典型题
    SiteMesh装饰模式
  • 原文地址:https://www.cnblogs.com/MysticBoy/p/1304533.html
Copyright © 2011-2022 走看看