• 大小: 23.56MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-15
  • 语言: C#
  • 标签: 语音识别  科大讯飞  

资源简介

调用科大讯飞接口,实现语音的录制、语音的合成及语音识别。

资源截图

代码片段和文件信息

using Microsoft.CognitiveServices.Speech;
using Microsoft.CognitiveServices.Speech.Audio;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Speech.Recognition.File.Input
{
    public class Recognition
    {
        public async void Voice(string inputNameWave SpeechConfig speechConfig)
        {
            string result = string.Empty;
            var stopRecognition = new TaskCompletionSource();
            using (var inputVoice = AudioConfig.FromWavFileInput(inputNameWave))
            {
                using (var speechRecognizer = new SpeechRecognizer(speechConfig inputVoice))
                {
                    speechRecognizer.Recognizing += (s e) =>
                    {
                        result = e.Result.Text;
                    };
                    speechRecognizer.Recognized += (s e) =>
                    {
                        if (e.Result.Reason == ResultReason.RecognizedSpeech)
                        {
                            result = e.Result.Text;
                        }
                        else if (e.Result.Reason == ResultReason.NoMatch)
                        {
                            result = “Error“;
                        }
                    };
                    speechRecognizer.Canceled += (s e) =>
                    {
                        result = “Error“ + e.Reason;

                        if (e.Reason == CancellationReason.Error)
                        {
                            result = “ErrorCode“ + e.ErrorCode + e.ErrorDetails;
                        }

                        stopRecognition.TrySetResult(0);
                    };

                    speechRecognizer.Sessionstarted += (s e) =>
                    {

                    };

                    speechRecognizer.Sessionstopped += (s e) =>
                    {
                        result = “Session stopped event“;

                        stopRecognition.TrySetResult(0);
                    };

                    // Starts continuous recognition
                    await speechRecognizer.StartContinuousRecognitionAsync().ConfigureAwait(false);

                    // Waits for completion.
                    // Use Task.WaitAny to keep the task rooted.
                    Task.WaitAny(new[] { stopRecognition.Task });

                    // Stops recognition.
                    await speechRecognizer.StopContinuousRecognitionAsync().ConfigureAwait(false);
                }
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.    145920  2019-05-17 15:08  WpfApplication3\.vs\WpfApplication3\v14\.suo

     文件        130  2019-04-22 15:44  WpfApplication3\packages\Baidu.AI.3.6.11\.nupkg.metadata

     文件       9467  2019-04-16 05:19  WpfApplication3\packages\Baidu.AI.3.6.11\.signature.p7s

     文件     112237  2019-05-16 15:22  WpfApplication3\packages\Baidu.AI.3.6.11\Baidu.AI.3.6.11.nupkg

     文件      88064  2019-04-16 11:35  WpfApplication3\packages\Baidu.AI.3.6.11\lib\net35\AipSdk.dll

     文件     109819  2019-04-16 11:35  WpfApplication3\packages\Baidu.AI.3.6.11\lib\net35\AipSdk.xml

     文件      88064  2019-04-16 11:35  WpfApplication3\packages\Baidu.AI.3.6.11\lib\net40\AipSdk.dll

     文件      88064  2019-04-16 11:35  WpfApplication3\packages\Baidu.AI.3.6.11\lib\net45\AipSdk.dll

     文件      88064  2019-04-16 11:35  WpfApplication3\packages\Baidu.AI.3.6.11\lib\netstandard2.0\AipSdk.dll

     文件      18722  2018-11-06 08:19  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\.signature.p7s

     文件        961  2018-11-06 15:16  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\Microsoft.CognitiveServices.Speech.props

     文件       1614  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx.h

     文件       4081  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_audio_config.h

     文件      19496  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_audio_stream.h

     文件       3213  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_audio_stream_format.h

     文件       1549  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_common.h

     文件       8407  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_enums.h

     文件        825  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_eventargs.h

     文件       8247  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_eventsignal.h

     文件       4826  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_intent_recognition_eventargs.h

     文件       2141  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_intent_recognition_result.h

     文件      10424  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_intent_recognizer.h

     文件       3398  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_intent_trigger.h

     文件       2029  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_keyword_recognition_model.h

     文件       3912  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_language_understanding_model.h

     文件       3454  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_properties.h

     文件      19921  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_recognition_async_recognizer.h

     文件       1972  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_recognition_base_async_recognizer.h

     文件       1664  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_recognition_eventargs.h

     文件       8773  2018-11-06 15:17  WpfApplication3\packages\Microsoft.CognitiveServices.Speech.1.1.0\build\native\include\cxx_api\speechapi_cxx_recognition_result.h

............此处省略408个文件信息

评论

共有 条评论