C# 如何控制麦克风输入

qq_32635221 2018-03-13 05:00:27
我想把本地音频当作麦克风的音源输入,可是网上没有资料,不吃从何处下手,有没有高人给点提示
...全文
641 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_32635221 2018-03-14
  • 打赏
  • 举报
回复
引用 2 楼 wanghui0380 的回复:
比如“Accord.Audio“,我随手在网上找的一段
 /// <summary>
        ///   播放录制的音频流。
        /// </summary>
        /// 
        private void btnPlay_Click(object sender, EventArgs e)
        {
            // First, we rewind the stream
            stream.Seek(0, SeekOrigin.Begin);

            // Then we create a decoder for it
            decoder = new WaveDecoder(stream);

            // Configure the track bar so the cursor
            // can show the proper current position
            if (trackBar1.Value < decoder.Frames)
                decoder.Seek(trackBar1.Value);
            trackBar1.Maximum = decoder.Samples;

            // Here we can create the output audio device that will be playing the recording
            output = new AudioOutputDevice(this.Handle, decoder.SampleRate, decoder.Channels);

            // Wire up some events
            output.FramePlayingStarted += output_FramePlayingStarted;
            output.NewFrameRequested += output_NewFrameRequested;
            output.Stopped += output_PlayingFinished;

            // Start playing!
            output.Play();

            updateButtons();
        }
请注意AudioOutputDevice这个类,从名字上你就可以猜出他就是 音频输出设备 类
请问有找到的链接地址吗 谢谢
kxyzjm62 2018-03-14
  • 打赏
  • 举报
回复
https://www.cnblogs.com/slgkaifa/p/6757890.html
依然冷暖 2018-03-13
  • 打赏
  • 举报
回复
我觉得没找到要换搜索关键字换个专业点的词搜索 比如麦克风 录音 之类的都是一个意思
wanghui0380 2018-03-13
  • 打赏
  • 举报
回复
比如“Accord.Audio“,我随手在网上找的一段
 /// <summary>
        ///   播放录制的音频流。
        /// </summary>
        /// 
        private void btnPlay_Click(object sender, EventArgs e)
        {
            // First, we rewind the stream
            stream.Seek(0, SeekOrigin.Begin);

            // Then we create a decoder for it
            decoder = new WaveDecoder(stream);

            // Configure the track bar so the cursor
            // can show the proper current position
            if (trackBar1.Value < decoder.Frames)
                decoder.Seek(trackBar1.Value);
            trackBar1.Maximum = decoder.Samples;

            // Here we can create the output audio device that will be playing the recording
            output = new AudioOutputDevice(this.Handle, decoder.SampleRate, decoder.Channels);

            // Wire up some events
            output.FramePlayingStarted += output_FramePlayingStarted;
            output.NewFrameRequested += output_NewFrameRequested;
            output.Stopped += output_PlayingFinished;

            // Start playing!
            output.Play();

            updateButtons();
        }
请注意AudioOutputDevice这个类,从名字上你就可以猜出他就是 音频输出设备 类
wanghui0380 2018-03-13
  • 打赏
  • 举报
回复
请百度“NAudio.” 或者“Accord.Audio”

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧