Universal Windows TTS with Muse


#1

Hi ,
I wrote my own code with Muse HeadBand, and i want to add TTS (Text to Speech) to my program.
I wrote Something and it doesnt make any sound.
I am attaching the code, if someone can help, i will be glad.
thanks.

void MainPage::btnTextToSpeech_Click(Platform::Object^ sender,
Windows::UI::Xaml::RoutedEventArgs^ e)
{

// InitializeComponent();
synthesizer = ref new SpeechSynthesizer();

String^ textToSpeech="Hello";

//textToSpeech = My_Text->Text;

task<SpeechSynthesisStream^>speakTask = create_task(synthesizer->SynthesizeTextToStreamAsync(textToSpeech));

speakTask.then([this, textToSpeech](SpeechSynthesisStream^ speechStream)
{
	MediaElement^ media = ref new MediaElement();
	media->SetSource(speechStream, speechStream->ContentType);
	media->AutoPlay = true;
	media->Play();	
});

}