开发者

How to solve Text-To-Speech?

i would like to ask a question. i am now facing problems about English Text To Speech. I used System.Speech.Synthesis; namespace from .Net framework for my ETTS in C#.Net. first I can completely convert text into wav file. but after save into wave file,i can't speak anymore in that windows form. but it can speak if not save to wave file.however after saved file,i can't speak anymore. i wrote following code for that program.

For Save text to Wave file

SaveFileDialog sfd = new SaveFileDialog();
        开发者_如何学运维sfd.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav";
        sfd.Title = "Save to a wave file";
        sfd.FilterIndex = 2;
        sfd.RestoreDirectory = true;

        if (sfd.ShowDialog() == DialogResult.OK)
        {
            FileStream fs = new FileStream(sfd.FileName, FileMode.Create, FileAccess.ReadWrite);
            voiceMe.SetOutputToWaveStream(fs);
            voiceMe.Speak(txtSpeakText.Text);
            fs.Close();
        }       

for Text to speech

        voiceMe.Volume = VolumeMe.Value;
        voiceMe.Rate = RateMe.Value;
        voiceMe.SpeakAsync(txtSpeakText.Text);

That is. if you not understand my question.please retell me. if you can solve that problem , Please tell me. Thanks you for your time.


Please try this just after you are done with saving.

 voiceMe.SetOutputToDefaultAudioDevice();

As you can guess, when you are saving, you set output to a wave file with voiceMe.SetOutputToWaveStream(fs);. And in order to make output to speaker again, you gotta use the statement above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜