1

我成功地在我的 C# 应用程序中使用 .NET 语音识别部分来处理基本的谈话内容。

除此之外,是否可以在我的应用程序识别它的同时记录它在我的应用程序中拾取的音频。我想将其保存以备后用,以便进行分析。

当我对着麦克风讲话时,您会创建一个单独的线程,然后将一些 .NET 录音放在那里吗?我只想将它们以 .wav 格式保存在本地目录中。一个简单的记录,如 48khz 和 16 位样本。

我正在使用普通表单应用程序,这是我现在拥有的语音代码类型,只是为了给你一个想法。

using System.Speech.Recognition;

//then inside the class and namespace I have 
    public partial class Form1 : Form
    {
        SpeechRecognitionEngine _recognizer = new SpeechRecognitionEngine();


//declared variables here
//now I initialize

        public Form1()
        {
            InitializeComponent();
            _recognizer.SetInputToDefaultAudioDevice();
            _recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(File.ReadAllLines(@"Commands.txt")))));
            _recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(_recognizer_SpeechRecognized);
            _recognizer.RecognizeAsync(RecognizeMode.Multiple);
            systemOnline();
        }

void _recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            string time = now.GetDateTimeFormats('t')[0];
            int ranNum;
            string speech = e.Result.Text;
            switch (speech)
            {

                //Open Google
                case "Google":
                //code opens google in default browser
4

1 回答 1

2

查看 Windows API。我相信您可以在那里注册一个处理程序/事件处理程序/拦截器,以获取音频数据。查看以下链接:也许有帮助

于 2013-08-20T14:42:05.010 回答