如何从头开发自己的文本到语音软件? [英] How can I develop an own text to speech software from scratch?

查看:68
本文介绍了如何从头开发自己的文本到语音软件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从头开发自己的文本到语音软件?我想用C ++ .net或C#语言启动它。我有c#和c ++ .net的编程技巧,但我不想使用第三方库,我想要一个完全自己的库。



我的项目不够用对我而言只是来自我的项目的样本。

我有几年的音乐音频技术和几个月的编程,但我遇到了Fast FT和Shortime FT的一些问题。



我尝试过:



 使用系统; 
使用 System.Collections.Generic;
使用 System.ComponentModel;
使用 System.Data;
使用 System.Drawing;
使用 System.Linq;
使用 System.Text;
使用 System.Threading.Tasks;
使用 System.Windows.Forms;

使用 System.Speech.Synthesis;
使用 System.Speech.AudioFormat;

public partial class Form1:Form
{
public Form1()
{
InitializeComponent();
}

List< string> all_lines_List = new List< string>();

private void Read_Click(对象 sender,EventArgs e)
{
if (comboBox1.SelectedItem!= null
{
button1.Enabled = false ;


SpeechSynthesizer speech_synthesizer = new SpeechSynthesizer();

ReadOnlyCollection< InstalledVoice> InstalledVoices = speech_synthesizer.GetInstalledVoices();



speech_synthesizer.SelectVoice(comboBox1.SelectedItem.ToString());
// speech_synthesizer.SelectVoice(MSMary);

speech_synthesizer.SetOutputToDefaultAudioDevice();
// PromptBuilder builder = new PromptBuilder();
// builder.AppendSsmlMarkup(< say-as interpret-as = \chs \> chair< / say -as>);

// speech_synthesizer.AddLexicon(new Uri (C:\\ W7 \\Spelling.pls),application / pls);

speech_synthesizer.Volume = 100 ;
speech_synthesizer.Rate = 0 ;

PromptBuilder builder = new PromptBuilder();
builder.AppendText( 这是WAVE文件的示例输出。,PromptEmphasis。强大);
builder.AppendSsmlMarkup( < say-as interpret-as = \WAVE \> ;椅子< / say-as>);

speech_synthesizer.Speak(建设者);

speech_synthesizer.Speak(richTextBox2.Text);

// speech_synthesizer.RemoveLexicon(new Uri(C:\\ W7 \\ \\\Spelling.pls));
button1.Enabled = true ;

System.Media.SystemSounds.Asterisk.Play();

Application.DoEvents();

}
else
{
System.Media.SystemSounds.Hand.Play();
MessageBox.Show( 请选择一个语音。);
}



}

private void Save_Without_Reading_Click( object sender,EventArgs e)
{

if (comboBox1.SelectedItem!= null
{
SpeechSynthesizer speech_synthesizer = new SpeechSynthesizer();

speech_synthesizer.SelectVoice(comboBox1.SelectedItem.ToString());

speech_synthesizer.SetOutputToDefaultAudioDevice();

speech_synthesizer.Volume = 100 ;
speech_synthesizer.Rate = 0 ;

speech_synthesizer.SetOutputToWaveFile(comboBox1.SelectedItem.ToString()+ - Speech.wav new SpeechAudioFormatInfo( 44100 ,AudioBitsPerSample.Sixteen,AudioChannel.Mono));

speech_synthesizer.Speak(richTextBox2.Text);
System.Media.SystemSounds.Asterisk.Play();

}
else
{
System.Media.SystemSounds.Hand.Play();
MessageBox.Show( 请选择一个语音。);
}


}

解决方案

微软已经做到了,只需使用它:

Windows文本到语音转换器示例 - C# - Visual Studio 2010年在C#for Visual Studio 2010中 [ ^ ]

How can I develop an own text to speech software from scratch? I want to start it in C++ .net or C# language. I have programming skills in c# and c++ .net but I can't wanna use 3rd party libraries, I want an entirely own one.

My project below is not enough for me and sample from my project only.
I have some years musical audio skills and programmatically some months but I have some problems with Fast FT and Shortime FT.

What I have tried:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Speech.Synthesis;
using System.Speech.AudioFormat;

 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        List<string> all_lines_List = new List<string>();

        private void Read_Click(object sender, EventArgs e)
        {
            if(comboBox1.SelectedItem!=null)
            {
                button1.Enabled = false;

                
                SpeechSynthesizer speech_synthesizer = new SpeechSynthesizer();

                ReadOnlyCollection<InstalledVoice> InstalledVoices = speech_synthesizer.GetInstalledVoices();
                


                speech_synthesizer.SelectVoice(comboBox1.SelectedItem.ToString());
                //speech_synthesizer.SelectVoice("MSMary");  
               
                speech_synthesizer.SetOutputToDefaultAudioDevice();
                //PromptBuilder builder = new PromptBuilder();
                //builder.AppendSsmlMarkup("<say-as interpret-as = \"chs\"> chair </say-as>");

                //speech_synthesizer.AddLexicon(new Uri("C:\\W7\\Spelling.pls"), "application/pls");
                
                speech_synthesizer.Volume = 100;
                speech_synthesizer.Rate = 0;

                PromptBuilder builder = new PromptBuilder();
                builder.AppendText("This is sample output to a WAVE file.", PromptEmphasis.Strong);
                builder.AppendSsmlMarkup("<say-as interpret-as = \"WAVE\"> chair </say-as>");

                speech_synthesizer.Speak(builder);

                speech_synthesizer.Speak(richTextBox2.Text);

                //speech_synthesizer.RemoveLexicon(new Uri("C:\\W7\\Spelling.pls"));
                button1.Enabled = true;                

                System.Media.SystemSounds.Asterisk.Play();

                Application.DoEvents();
            
            }
            else
            {
                System.Media.SystemSounds.Hand.Play();
                MessageBox.Show("Please, Select a Voice.");
            }


           
        }

        private void Save_Without_Reading_Click(object sender, EventArgs e)
        {
                      
            if (comboBox1.SelectedItem != null)
            {
                SpeechSynthesizer speech_synthesizer = new SpeechSynthesizer();

                speech_synthesizer.SelectVoice(comboBox1.SelectedItem.ToString());
                
                speech_synthesizer.SetOutputToDefaultAudioDevice();

                speech_synthesizer.Volume = 100;
                speech_synthesizer.Rate = 0;

                speech_synthesizer.SetOutputToWaveFile(comboBox1.SelectedItem.ToString() + " - Speech.wav", new SpeechAudioFormatInfo(44100, AudioBitsPerSample.Sixteen, AudioChannel.Mono));

                speech_synthesizer.Speak(richTextBox2.Text);
                System.Media.SystemSounds.Asterisk.Play();                

            }
            else
            {
                System.Media.SystemSounds.Hand.Play();
                MessageBox.Show("Please, Select a Voice.");
            }

            
        }        

解决方案

Microsoft already did it, just use it:
Windows Text to Speech Converter Sample - C# - Visual Studio 2010 in C# for Visual Studio 2010[^]


这篇关于如何从头开发自己的文本到语音软件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆