在Windows Phone上获取原始麦克风数据? [英] Getting raw microphone data on the Windows Phone?

查看:102
本文介绍了在Windows Phone上获取原始麦克风数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Windows Phone 7上获取原始麦克风数据来测量环境声音?如果是这样,我该怎么办?

Is it possible to obtain raw microphone data on the Windows Phone 7 to measure the ambient sound? If so, how can I do this?

推荐答案

不确定您是否熟悉WP7中的麦克风通话 但您可以查看博客帖子以获得完整的详细教程:

not sure if you are familiar with Dealing with micrphone in WP7 or not but you can check this blog post for a full detailed tutorial :

您使用数据大小初始化缓冲区:

you initialize a buffer with the size of the data :

_buffer = new byte[_microphone.GetSampleSizeInBytes(_microphone.BufferDuration)];

,只要此事件处理程序中的麦克风数据准备就绪,就可以从麦克风获取数据并将其添加到缓冲区中,然后您就可以使用它进行任何操作:

and whenever the Microphone data is ready in this event handler get the data from the microphone add it to the Buffer then you can do anything using it :

  private void MicrophoneBufferReady(object sender, EventArgs e)
    {
        _microphone.GetData(_buffer);
        //Do something with the data   
    }

您需要包括所有内容,所有内容均在本教程的详细信息"中说明

you'll need to include and everything is stated in the tutorial in Details

using Microsoft.Xna.Framework.Audio;

这篇关于在Windows Phone上获取原始麦克风数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆