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 );//把该文本直接转换为文件。 可以用播放器来播放。
                }
            }
        }
    }

  • 相关阅读:
    Android开发笔记记住用户名密码(SharedPreferences)
    Android 开发笔记——全局变量
    linker command failed with exit code 1 (use v to see invocation)
    cocos2diphone搭建开发环境。
    google 打不开?
    iOS 局部变量 setTag后可在别的地方调用 viewWithTag
    _OBJC_CLASS_$_SKStoreProductViewController
    iOS 合并.a文件,制作通用静态库
    NSUserDefaults 数据的存取
    xcode 4 制作静态库详解 [转]
  • 原文地址:https://www.cnblogs.com/MysticBoy/p/1304533.html
Copyright © 2011-2022 走看看