PCM 波数据可视化

发布于 2024-12-13 11:56:14 字数 764 浏览 7 评论 0原文

我有一个 API 可以为我提供 PCM 波形数据:

http://msdn.microsoft。 com/en-us/library/ff966424.aspx

用作 SoundEffect 参数的 byte[] 缓冲区格式 构造函数、Microphone.GetData 方法和 DynamicSoundEffectInstance.SubmitBuffer方法是PCM波形数据。 此外,PCM 格式是交错的并且采用小尾数法。

音频格式有以下限制:

  • 音频通道可以是单声道 (1) 或立体声 (2)。
  • PCM 波形文件 每个样本必须有 16 位。
  • 采样率必须介于 8,000 Hz 之间 和 48,000 赫兹。
  • 立体声数据的交错是左声道 正确的渠道。

我想根据这些数据进行可视化。

我想将音高分为三等份,并获取每个的音量/级别。

所以,如果我低声说话,我会得到一个高值,然后是 2 个低值,如果我正常说话,我会得到一个低值,一个高值和一个低值,如果我高声说话,我会得到一个低值,一个高值和一个低值我得到两个低值和一个高值。

我怎样才能做到这一点?我从未尝试过任何处理声音的方法,所以我处于第 1 级,不知道从哪里开始。

I have an API that gives me PCM wave data:

http://msdn.microsoft.com/en-us/library/ff966424.aspx

The byte[] buffer format used as a parameter for the SoundEffect
constructor, Microphone.GetData method, and
DynamicSoundEffectInstance.SubmitBuffer method is PCM wave data.
Additionally, the PCM format is interleaved and in little-endian.

The audio format has the following constraints:

  • The audio channels can be mono (1) or stereo (2).
  • The PCM wave file
    must have 16-bits per sample.
  • The sample rate must be between 8,000 Hz
    and 48,000 Hz.
  • The interleaving for stereo data is left channel to
    right channel.

I would like to do a visualisation based on this data.

I want to split the sound pitch levels into 3rds, and get the volume/level of each.

So, if i speak in a low voice, i'll get a high value, then 2 low values, if i speak normally i'd get a low value, a high value and a low value and if i speak in a high voice i get 2 low values, and a high value.

How can i achieve this? I've never tried anything dealing with sound, so i'm at level 1, and don't know where to start.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罪歌 2024-12-20 11:56:14

完整的答案可能太复杂,无法在这里给出,但您需要获取时域 PCM 样本数据并从中导出频域表示,以便您可以评估不同频率范围内的信号电平。执行此操作的技术称为快速傅立叶变换 (FFT)。自己实现这一点需要大量的 DSP 知识,因此您最好的方法可能是寻找一个提供现成可用的 FFT 实现的库。

A full answer would probably be too complex to give here but you need to take the time-domain, PCM sample data and derive the frequency-domain representation from it so that you can then assess the level of the signal in the different frequency ranges. The technique for doing this is known as the Fast Fourier Transfer (FFT). Implementing this yourself requires a significant amount of knowledge of DSP, so perhaps your best approach would be to source a library that offers an FFT implementation out-of-the-box that you can use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文