音频捕获未按预期工作

发布于 2024-10-09 12:16:29 字数 774 浏览 0 评论 0原文

在我的 Microsoft Surface 应用程序中,我想使用语音捕获。所以我按照这里提到的教程(http://opensebj.blogspot.com/2009/04/naudio-tutorial-5-recording-audio.html)并修改了NAudio.dll以能够执行以下代码:

class AudioRecording
    {
        private WaveMixerStream32 mixer;

        public AudioRecording()
        {
            mixer = new WaveMixerStream32();
            mixer.AutoStop = false;

        }

        public void start()
        {
            Console.WriteLine("Start recording"); 
            mixer.StreamMixToDisk("Test.wav");
            mixer.StartStreamingToDisk();
        }

        public void stop()
        {
            Console.WriteLine("Stop recording");
            mixer.StopStreamingToDisk();
        }
    }

但是这并不能真正捕捉到声音。我只是创建了一个 58 字节的文件,该文件是空的。我做错了什么?

In my Microsoft Surface application I'd like to use voice capture. So I followed the tutorial metioned here (http://opensebj.blogspot.com/2009/04/naudio-tutorial-5-recording-audio.html) and modified the NAudio.dll to be able to execute the following code:

class AudioRecording
    {
        private WaveMixerStream32 mixer;

        public AudioRecording()
        {
            mixer = new WaveMixerStream32();
            mixer.AutoStop = false;

        }

        public void start()
        {
            Console.WriteLine("Start recording"); 
            mixer.StreamMixToDisk("Test.wav");
            mixer.StartStreamingToDisk();
        }

        public void stop()
        {
            Console.WriteLine("Stop recording");
            mixer.StopStreamingToDisk();
        }
    }

But this doesn't really capture the sound. I just create a file of 58 bytes, that is empty. What Am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文