【问题标题】:C# Cortana voice activation programmaticallyC# Cortana 以编程方式激活语音
【发布时间】:2015-02-08 19:05:58
【问题描述】:

我正在尝试以编程方式调用 Cortana。

我已经在使用此代码启动 Cortana

await Launcher.LaunchUriAsync(new Uri("bing://home"));

问题在于,为了进行搜索,您必须单击 Cortana 中的麦克风按钮。

我想要的是,当 Cortana 启动时,不应提示用户按下麦克风按钮以进行搜索。就像在 Cortana 中一样,只要我愿意,或者至少在它打开时,它就会开始收听。

这可能吗?如果是那怎么办?

【问题讨论】:

    标签: c# windows-phone-8.1 cortana


    【解决方案1】:

    这是极不可能的,因为应用开发者能够任意开始记录用户所说的内容存在隐私问题。

    【讨论】:

      【解决方案2】:

      您是否尝试过在 Windows 10 上使用 ContinuousRecognitionSession。

      private SpeechRecognizer speechRecognizer;
      private CoreDispatcher dispatcher;
      private StringBuilder dictatedTextBuilder;
      
      this.dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
      this.speechRecognizer = new SpeechRecognizer();
      SpeechRecognitionCompilationResult result =
      
      await speechRecognizer.CompileConstraintsAsync();
      speechRecognizer.ContinuousRecognitionSession.ResultGenerated +=
      ContinuousRecognitionSession_ResultGenerated;
      
      private async void ContinuousRecognitionSession_ResultGenerated(
      SpeechContinuousRecognitionSession sender,
      SpeechContinuousRecognitionResultGeneratedEventArgs args)
      {
      
      if (args.Result.Confidence == SpeechRecognitionConfidence.Medium ||
        args.Result.Confidence == SpeechRecognitionConfidence.High)
        {
          dictatedTextBuilder.Append(args.Result.Text + " ");
      
          await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
          {
            dictationTextBox.Text = dictatedTextBuilder.ToString();
            btnClearText.IsEnabled = true;
          });
        }
      else
      {
        await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
          {
            dictationTextBox.Text = dictatedTextBuilder.ToString();
          });
      }
      }
      

      这里是完整的example

      考虑在前台也使用 Cortana 集成您的应用。看看here

      【讨论】:

      • 是的,我知道语音识别器以及如何将 Cortana 集成到应用程序中。我的要求不同,我想通过蓝牙或其他应用程序调用 Cortana。但她从来没有开始自己听,除非按下扬声器按钮,或者最近,你说“嘿 Cortana!”
      猜你喜欢
      • 2015-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多