zoukankan      html  css  js  c++  java
  • MS Speech/ azure

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Shapes;
    
    using System.IO;
    using Microsoft.CognitiveServices.Speech;
    using Microsoft.CognitiveServices.Speech.Audio;
    
    
    namespace SpeechRecTest
    {
        /// <summary>
        /// Interaction logic for AzureSpeechWind.xaml
        /// </summary>
        public partial class AzureSpeechWind : Window
        {
            public AzureSpeechWind()
            {
                InitializeComponent();
                Loaded += AzureSpeechWind_Loaded;
            }
    
            private  void AzureSpeechWind_Loaded(object sender, RoutedEventArgs e)
            {
               // var speechConfig = SpeechConfig.FromSubscription("8ec6730993d54cf9a9cec0f5d08b8e8b", "eastus");
                //var speechConfig = SpeechConfig.FromSubscription("<paste-your-speech-key-here>", "<paste-your-speech-location/region-here>");
                Start();
            }
    
            async static Task FromMic(SpeechConfig speechConfig)
            {
                 var audioConfig = AudioConfig.FromDefaultMicrophoneInput();
                 var recognizer = new SpeechRecognizer(speechConfig, audioConfig);
    
                Console.WriteLine("Speak into your microphone.");
                var result = await recognizer.RecognizeOnceAsync();
                Console.WriteLine($"RECOGNIZED: Text={result.Text}");
                
    
            }
    
            async static Task Start()
            {
                try
                {
                    // var speechConfig = SpeechConfig.FromSubscription("<paste-your-speech-key-here>", "<paste-your-speech-location/region-here>");
                    var speechConfig = SpeechConfig.FromSubscription("8ec6730993d54cf9a9cec0f5d08b8e8b", "eastus");
                    await FromMic(speechConfig);
                }
                catch(Exception ex) {
    
                    Console.WriteLine($"{ex.Message }");
    
                }
            }
    
        }
    }
    

      

    fffffffffffffffff
    test red font.
  • 相关阅读:
    第三章-5、图片左右滑动(动态面板引导页面)
    第三章-8、抽屉导航(动态面板)
    第三章-7、没做
    第三章-6、失败
    第三章-4、瀑布流(动态面板)
    第三章-3、跳转页面&返回页面
    第三章-2、设置条件进行外部连接,跳转页面
    第三章-1、界面原件属性使用(登录界面)
    6、如何将excel表格中的图片批量居中对齐
    React Native
  • 原文地址:https://www.cnblogs.com/wgscd/p/15243772.html
Copyright © 2011-2022 走看看