如何从WAV样本数据中提取频率?
我正在用 c 开发一个应用程序来读取简单的 PCM WAV 文件。我的问题是,我应该如何解释数据块中的样本,以便提取样本的频率?
给定一个 WAV 示例,原始数据如何表示频率。例如,这个数据块,24 17 1e f3,对于立体声,16 位,左声道样本是,0x1724 = 5924d,意味着 5924Hz ?对于有符号的样本或人类听不到的频率,怎么可能呢?
I'm developing an application in c to read simple PCM WAV files. My question is, how should I interpret the samples from the data chunk, so that I can extract the sample's frequency?
Given a WAV example, how can the original data represent frequencies. E.g. this data chunk, 24 17 1e f3, for stereo, 16 bits, the left channel sample is, 0x1724 = 5924d, means 5924Hz ? How can that be, for samples that are signed or frequencies that humans can´t hear?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的假设是不正确的。
样本数据只是实际声波的数字表示。数字代表波幅,阵列偏移代表时间。
我建议阅读如何表示音频,特别是
PCM。
要将这些数据(幅度与时间)转换为频率数据,您需要了解 傅里叶变换
我真的建议在尝试进行任何音频处理之前花时间阅读这些内容。
Your assumption is incorrect.
The sample data is simply a digital representation of the actual sound wave. The numbers represent wave amplitude, the array offset represents time.
I would suggest reading about How Audio is Represented, specifically
PCM.
To convert this data (amplitude-vs-time) to frequency data, you need to understand the basic concepts of The Fourier Transform
I really suggest taking the time to read these before trying to do any audio processing.
您可以提取 WAV 标头中的采样率,但如果您需要录制的音频的实际频率数据,即 200Hz 时有多少能量、2kHz 时有多少能量、8kHz 时有多少能量等,您需要执行以下操作: FFT,或通过频谱图运行它。
You can extract the sample rate in the WAV header, but if you need the actual frequency data of the audio that was recorded, i.e. how much energy at 200Hz, how much at 2kHz, how much at 8kHz, etc. you need to do an FFT, or run it through a spectrogram.