private async void Button_Click_Earth(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Earth is the third planet from the sun.\n" + " It is the only place in the Universe known to harbor life.\n" + " It is orbited by the Moon, Earth's only natural satellite.\n" + " It is the largest of the four terrestrial planets.\n"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); DisplayPlanet.Source = new BitmapImage(new Uri(base.BaseUri, "Assets/Earth.jpg")); PName.Text = "Name: Earth"; PDesignation.Text = "Designation: Third Planet in the Solar System"; PType.Text = "Type: Terrestrial Planet"; PRadius.Text = "Radius: 6371km"; PVolume.Text = "Volume: 1.08321 ×10^12 km3"; PMass.Text = "Mass: 5.972 × 10^24 kg"; PGravity.Text = "Surface Gravity: 9.807 m/s2"; PDescription.Text = "Description: Earth is the third planet from the sun.\n" + "It is the only place in the Universe known to harbor life.\n" + "It is orbited by the Moon, Earth's only natural satellite.\n" + "It is the largest of the four terrestrial planets.\n"; }
private async void Button_Click_Sun(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement();// This creates a speech synthesis object, voicing the description var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("The sun is the star at the centre of our solar system. It is a sphere of hot plasma (mostly hydrogen) that radiates an incredible amount of heat. The temperature of its core is " + "about 15 million degrees Celsius. Life on Earth depends on the sun for energy and heat."); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); DisplayPlanet.Source = new BitmapImage(new Uri(base.BaseUri, "Assets/Sun.jpg")); //Changes the image displayed at top of screen // Below is the code for changing the text displayed on screen PName.Text = "Name: Sun"; PDesignation.Text = "Designation: Star"; PType.Text = "Type: G-type main-sequence star (G2V)"; PRadius.Text = "Radius: 695700km"; PVolume.Text = "Volume: 1.41×10^18 km3"; PMass.Text = "Mass: 1.989 × 10^30 kg"; PGravity.Text = "Surface Gravity: 274 m/s2"; PDescription.Text = "Description: The sun is the star at the centre of our Solar System.\n" + "It is a sphere of hot plasma (mostly hydrogen) that radiates heat.\n" + "The temperature of its core is about 15 million degrees Celsius.\n" + "Life on Earth depends on the sun for energy and heat.\n"; }
// Based on Microsoft Documentation @ https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-uwp?view=vs-2019 private async void TextToSpeech(object sender, RoutedEventArgs e) { // get the text from the input-field TalkToMeInput.Document.GetText(Windows.UI.Text.TextGetOptions.AdjustCrlf, out TextToSpeak); if (TextToSpeak == string.Empty) { TextToSpeak = "Hello World"; } if (mediaElement == null) { mediaElement = new MediaElement(); } if (synth == null) { synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); } // pass the text into the windows SpeechSynthesis and play Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(TextToSpeak); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); Debug.WriteLine(string.Format("Trying to SpeechSynthesis {0}.", TextToSpeak)); }
private async void Button_Click_Neptune(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Neptune is the eighth and farthest known planet from the sun in the Solar System.\n" + " It is similar in composition to its twin, Uranus.\n" + " It is named after the Roman god of the sea.\n" + " It is not visible to the naked eye, and was the only planet in the Solar System discovered through mathematical prediction rather than empirical observation.\n"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); DisplayPlanet.Source = new BitmapImage(new Uri(base.BaseUri, "Assets/Neptune.jpg")); PName.Text = "Name: Neptune"; PDesignation.Text = "Designation: Eight planet in the Solar System"; PType.Text = "Type: Ice Giant"; PRadius.Text = "Radius: 24622km"; PVolume.Text = "Volume: 6.254 × 10^13 km3"; PMass.Text = "Mass: 1.0243 × 10^26 kg"; PGravity.Text = "Surface Gravity: 11.15 m/s2"; PDescription.Text = "Description: Neptune is the eighth and farthest known planet from the sun in the \nSolar System.\n" + "It is similar in composition to its twin, Uranus.\n" + "It is named after the Roman god of the sea.\n" + "It is not visible to the naked eye, and was the only planet \nin the Solar System discovered through mathematical prediction rather than \nempirical observation.\n"; }
private async void Button_Click_Mars(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Mars is the fourth planet from the sun.\n" + " It is a cold, barren world named after the Roman god of war.\n" + " Known as the Red Planet due to the presence of iron oxide, giving it a reddish tint.\n" + " Scientists believe Mars might once have been able to support life, and may possibly harbor extant life beneath its surface.\n"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); DisplayPlanet.Source = new BitmapImage(new Uri(base.BaseUri, "Assets/Mars.jpg")); PName.Text = "Name: Mars"; PDesignation.Text = "Designation: Fourth planet in the Solar System"; PType.Text = "Type: Terrestrial Planet"; PRadius.Text = "Radius: 3390km"; PVolume.Text = "Volume: 6.4171 × 10^23 km3"; PMass.Text = "Mass: 6.39 × 10^23 kg"; PGravity.Text = "Surface Gravity: 3.711 m/s2"; PDescription.Text = "Description: Mars is the fourth planet from the sun.\n" + "It is a cold, barren world named after the Roman god of war.\n" + "Known as the Red Planet due to the presence of iron oxide, giving it a \nreddish tint.\n" + "Scientists believe Mars might once have been able to support life, and \nmay possibly harbor extant life beneath its surface.\n"; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is string && !string.IsNullOrWhiteSpace((string)e.Parameter)) { greeting.Text = $"Hi, {e.Parameter}"; } else { greeting.Text = "Hi!"; } if (e.NavigationMode == NavigationMode.Back) { goto F1; } MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(greeting.Text); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); F1: this.BackButton.Visibility = this.Frame.CanGoBack ? Visibility.Visible : Visibility.Collapsed; base.OnNavigatedTo(e); }
private async Task SpeakAsync(string text) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(text); mediaElement.SetSource(stream, stream.ContentType); }
private async void Tapped_1_1(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var talk = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await talk.SynthesizeTextToStreamAsync("DONKEY, D O N K E Y"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
public async Task speachAsync(string texte) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(texte); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void btLer_Click(object sender, RoutedEventArgs e) { MediaElement media = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(edConteudo.Text); media.SetSource(stream, stream.ContentType); media.Play(); }
private async void button_Click(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them ? To die: to sleep; No more; and by a sleep to say we end"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void Test_Button_Click(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("War Gear Calculator"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
public static async System.Threading.Tasks.Task <int> SynSpeechPlayAsyncServiceAsync(byte[] bytes, System.Collections.Generic.Dictionary <string, string> apiArgs) { using (Windows.Media.SpeechSynthesis.SpeechSynthesizer synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer()) { Windows.Media.SpeechSynthesis.SpeechSynthesisStream synthStream = await synth.SynthesizeTextToStreamAsyncServiceAsync(text, apiArgs); // doesn't handle special characters such as quotes await Audio.PlayFileAsync(synthStream, synthStream.ContentType); } return(0); }
private async void Next_0_1(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var talk = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await talk.SynthesizeTextToStreamAsync("Cats play with string."); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void Sentence2(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var talk = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await talk.SynthesizeTextToStreamAsync("Horses jump really high. Tigers are very dangerous."); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void Button_Click(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var syn = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stm = await syn.SynthesizeTextToStreamAsync("Hello from Universal Windows Platform!"); mediaElement.SetSource(stm, stm.ContentType); mediaElement.Play(); }
private async void playAudio() { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(timerStartSpeech + time.ToString() + " minutes"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void Next_1_0(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var talk = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await talk.SynthesizeTextToStreamAsync("Horses jump over fences."); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
/*********************************************************************** * Build a voice reader to repeat the out put to the user. * *********************************************************************/ private async void VoiceMessage(string voice) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(voice); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void Sentence1(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var talk = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await talk.SynthesizeTextToStreamAsync("Dogs are humans best friend. Cats love to sleep."); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void SpeakButton_Click(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(ConvertedValueTextBox.Text); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
//this part will be very important for our app. in fact, this is an event that occur each time the button is pressed private async void Button_Click(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var audio = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await audio.SynthesizeTextToStreamAsync("Hello m**********r world! XD"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void Button_Click(object sender, RoutedEventArgs e) { MediaElement voice = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("I Like Potatoes"); voice.SetSource(stream, stream.ContentType); voice.Play(); }
private async void button_Click(object sender, RoutedEventArgs e) { MediaElement boomButton = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Pied Piper is a middle-out compression solution, making data storage problems smaller."); boomButton.SetSource(stream, stream.ContentType); boomButton.Play(); }
private async void button_Click(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Welcome on Holodesk, thanks!"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void PrintButton(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("printing ... ... ... not"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void Button_Click(object sender, RoutedEventArgs e) { MediaElement mediaElement = new MediaElement(); var talk = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await talk.SynthesizeTextToStreamAsync("Learn animals and spelling!"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
public async void SayWord(string word) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(word); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
private async void Button_Click(object sender, RoutedEventArgs e) { var mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Hello, World!"); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }
public virtual async void Chit(string a) { MediaElement mediaElement = new MediaElement(); var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync(a); mediaElement.SetSource(stream, stream.ContentType); mediaElement.Play(); }