private async void PresentRodolfo() { var auth = new Authentication("713034f5c7994f089c1d5a70c1a12ede", "54c4cd393679455d90a48250cde0cfa4"); var token = auth.GetAccessToken(); var requestUri = "https://speech.platform.bing.com/synthesize"; var sb = new StringBuilder(); sb.AppendFormat("Hola, soy Rodolfo, la mascota de ENCAMINA."); sb.AppendFormat("¿Qué tipo de imagen quieres analizar?"); var cortana = new Synthesize(new Synthesize.InputOptions() { RequestUri = new Uri(requestUri), Text = sb.ToString(), VoiceType = Gender.Female, Locale = "es-es", VoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)", OutputFormat = AudioOutputFormat.Riff16Khz16BitMonoPcm, AuthorizationToken = "Bearer " + token.access_token, }); cortana.OnAudioAvailable += PlayAudio; cortana.OnError += ErrorHandler; await cortana.Speak(CancellationToken.None); cortana = null; }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var currentView = SystemNavigationManager.GetForCurrentView(); currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; currentView.BackRequested += CurrentView_BackRequested; var vm = e.Parameter as ImageViewModel; GridImages.ItemsSource = vm.ImageCollection; var auth = new Authentication("713034f5c7994f089c1d5a70c1a12ede", "54c4cd393679455d90a48250cde0cfa4"); var token = auth.GetAccessToken(); var requestUri = "https://speech.platform.bing.com/synthesize"; var sb= new StringBuilder(); sb.Append(vm.ImageCollection.ToList().FirstOrDefault().Nombre); sb.AppendFormat("Es {0} ", vm.ImageCollection.ToList().FirstOrDefault().Sexo); sb.AppendFormat("Tiene {0} años",vm.ImageCollection.ToList().FirstOrDefault().Edad); sb.AppendFormat("Tiene un parecido con {0} de un {1} por ciento ",(vm.ImageCollection.ToList().FirstOrDefault().Sexo.Equals("Hombre")?"Chuck Norris":"Angelina Jolie"), vm.ImageCollection.ToList().FirstOrDefault().Similar); var cortana = new Synthesize(new Synthesize.InputOptions() { RequestUri = new Uri(requestUri), Text = sb.ToString(), VoiceType = Gender.Female, Locale = "es-es", VoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)", OutputFormat = AudioOutputFormat.Riff16Khz16BitMonoPcm, AuthorizationToken = "Bearer " + token.access_token, }); cortana.OnAudioAvailable += PlayAudio; cortana.OnError += ErrorHandler; cortana.Speak(CancellationToken.None).Wait(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var currentView = SystemNavigationManager.GetForCurrentView(); currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; currentView.BackRequested += CurrentView_BackRequested; var vm = e.Parameter as TextViewModel; GridImages.ItemsSource = vm.TextCollection; var auth = new Authentication("713034f5c7994f089c1d5a70c1a12ede", "54c4cd393679455d90a48250cde0cfa4"); var token = auth.GetAccessToken(); var requestUri = "https://speech.platform.bing.com/synthesize"; var cortana = new Synthesize(new Synthesize.InputOptions() { RequestUri = new Uri(requestUri), Text =vm.TextCollection.ToList().FirstOrDefault().Nombre, VoiceType = Gender.Female, Locale = "es-es", VoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)", OutputFormat = AudioOutputFormat.Riff16Khz16BitMonoPcm, AuthorizationToken = "Bearer " + token.access_token, }); cortana.OnAudioAvailable += PlayAudio; cortana.OnError += ErrorHandler; cortana.Speak(CancellationToken.None).Wait(); }
private async void ContinuousRecognitionSession_ResultGenerated(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args) { if (!this.Completed) { try { //sender.StopAsync(); //this.Completed = true; sender.CancelAsync(); } catch (Exception) { } await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var mensaje = args.Result.Text.Replace(".", string.Empty); if (mensaje.Contains("Text")) mensaje = "Texto"; var vm = new ImageSearchViewModel(); // mensaje = "Texto"; vm.Search(mensaje); if (vm.SearchResult.Count > 0) { Frame.Navigate(typeof (SearchListView), vm); } else { var auth = new Authentication("713034f5c7994f089c1d5a70c1a12ede", "54c4cd393679455d90a48250cde0cfa4"); var token = auth.GetAccessToken(); var requestUri = "https://speech.platform.bing.com/synthesize"; var sb = new StringBuilder(); sb.AppendFormat("No se han encontrado resultados de búsqueda."); var cortana = new Synthesize(new Synthesize.InputOptions() { RequestUri = new Uri(requestUri), Text = sb.ToString(), VoiceType = Gender.Female, Locale = "es-es", VoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)", OutputFormat = AudioOutputFormat.Riff16Khz16BitMonoPcm, AuthorizationToken = "Bearer " + token.access_token, }); cortana.OnAudioAvailable += PlayAudio; cortana.OnError += ErrorHandler; cortana.Speak(CancellationToken.None); cortana = null; } }); } }