extAudioFile 数据...我得到了正确的东西吗?

发布于 2024-09-18 07:30:13 字数 3133 浏览 5 评论 0原文

我正在使用 Core Audio SDK 文档中提供的 EXTAudioFileReadTest 应用程序,并且尝试从 mData 缓冲区获取所有浮点值,以便我可以用它们绘制波形。

目前,我正在打印单通道的浮点值,这就是我在控制台中得到的内容:

2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] 0.127136
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] -0.057033
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] -0.146455
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] 0.090759
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] 0.240837
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] -0.072719
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] -0.258782
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] -0.063972
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] 0.088692
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] 0.153571
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] 0.080644
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] -0.087060
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] 0.196455
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] 0.167777
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] -0.192430
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] -0.209936
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] 0.012049
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] 0.110493
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.150715
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.016413
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] -0.056843
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.206117
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.020673
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] -0.561129
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] -0.184265
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.620910
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] 0.309018
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] -0.371634
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] -0.238362
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] 0.125136
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] 0.139757
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] -0.023419
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] -0.142903
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] 0.041068
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] 0.252621
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] -0.002240
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] -0.261686
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] -0.105053
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] 0.072798
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] 0.141572
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] 0.110190

我想我很困惑..因为我期望找到某种类型的电压样本而不是-1和1之间的数字。这些值的实际含义是什么?将这些值转换为 0 到 1 之间的某个上限/下限的好公式是什么?

提前致谢。我一直在到处搜索,但在任何地方都找不到此信息......尤其是在文档中。

I am using the EXTAudioFileReadTest app provided in the Core Audio SDK documentation and I'm trying to get all of the floating point values from the mData buffer so that I can draw a waveform with them.

Currently, I'm printing out the floating point values for single channel and this is what I'm getting in the console:

2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] 0.127136
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] -0.057033
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] -0.146455
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] 0.090759
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] 0.240837
2010-09-10 19:22:43.360 ExtAudioFileReadTest[71828:a0f] -0.072719
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] -0.258782
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] -0.063972
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] 0.088692
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] 0.153571
2010-09-10 19:22:43.361 ExtAudioFileReadTest[71828:a0f] 0.080644
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] -0.087060
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] 0.196455
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] 0.167777
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] -0.192430
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] -0.209936
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] 0.012049
2010-09-10 19:22:43.383 ExtAudioFileReadTest[71828:a0f] 0.110493
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.150715
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.016413
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] -0.056843
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.206117
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.020673
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] -0.561129
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] -0.184265
2010-09-10 19:22:43.384 ExtAudioFileReadTest[71828:a0f] 0.620910
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] 0.309018
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] -0.371634
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] -0.238362
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] 0.125136
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] 0.139757
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] -0.023419
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] -0.142903
2010-09-10 19:22:43.385 ExtAudioFileReadTest[71828:a0f] 0.041068
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] 0.252621
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] -0.002240
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] -0.261686
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] -0.105053
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] 0.072798
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] 0.141572
2010-09-10 19:22:43.386 ExtAudioFileReadTest[71828:a0f] 0.110190

I guess i'm confused.. .as I was expecting to find some type of voltage sample and not a number between -1 and 1. What do these values actually mean? What would be a good formula for converting these values to some upper/lower limit that would be between 0 and 1?

Thanks in advance. I've been searching all over the place and can't find this information anywhere... especially not in the documentation.

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

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

发布评论

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

评论(2

强辩 2024-09-25 07:30:13

这是正常的。

音频样本的通用浮点表示从 [-1...1] 调制;其中值 -1 和 1 代表 0 dBFS 处的一个样本。

浮点值“0.0”的连续流表示无声信号。

没有直流偏移的信号在正域和负域具有相同的权重。

如果您想将这些值转换为 [0...1],请使用以下公式:

result = (0.5 * inputSample) + 0.5;

但如果信号超出 [-1...1],您可能必须使用更复杂的算法。

在大多数情况下,如果您想将其存储为浮点型,则应将其保留为 [-1...1]。

this is normal.

the common floating point representation of audio samples modulate from [-1...1]; where the values -1 and 1 represent one sample at 0 dBFS.

a continuous stream of floating point values '0.0' represents a silent signal.

a signal with no DC offset will have equal weight in the positive and negative domains.

if you'd like to convert these values to [0...1], use the formula:

result = (0.5 * inputSample) + 0.5;

but you may have to use a more sophisticated algorithm if the signal extends beyond [-1...1].

in most cases, you should keep it at [-1...1] if you want to store it in floating point.

一生独一 2024-09-25 07:30:13

我想我已经弄清楚了。我刚刚在 Excel 中绘制了上面的这些点,它看起来像一个波形。我没有意识到它也会给出负电压......但这是有道理的。

I think i've figured this out. I just graphed those points above in excel and it seems to look like a waveform. I didn't realize it was giving the negative voltages as well... but it makes sense.

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