windows RT / Universal app, Text to speech "Save as Mp3"

Codeviews

I'm trying to make a speech to text universal app but got stuck on one thing. I looked all over the internet and could not find a proper solution which works.. So I came here.. Basically I want the app to save what ever is in the text box as mp3. Here is my code so far:

 private void Speak_Click(object sender, RoutedEventArgs e)
    {
        SpeakText(Text.Text);
    }
    public async void SpeakText(string TTS)
            {
                SpeechSynthesizer ttssynthesizer = new SpeechSynthesizer();

                //Set the Voice/Speaker
                using (var Speaker = new SpeechSynthesizer())
                {
                    Speaker.Voice = (SpeechSynthesizer.AllVoices.First(x => x.Gender == VoiceGender.Female));

                    ttssynthesizer.Voice = Speaker.Voice;
                }

                SpeechSynthesisStream ttsStream = await ttssynthesizer.SynthesizeTextToStreamAsync(TTS);

                //play the speech
                MediaElement media = new MediaElement();
                media.SetSource(ttsStream, " ");
            }
Chubosaurus Software

I think you can save SpeechSynthesisStream as just a .wav file. Then you can re-encode it to anything you like using a MediaTranscoder class.

MSDN: Media Transcoder

Sample Project using Media Transcoder -- use it as a refeence


Some extra help saving the stream to a wav file : SpeakText.xaml.cpp

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related