Seven
Seven

Reputation: 441

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.

Upvotes: 1

Views: 332

Answers (1)

Tae-Sung Shin
Tae-Sung Shin

Reputation: 20620

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.

Upvotes: 2

Related Questions