如何确定 WAV 文件的声音大小?

发布于 2024-07-24 08:17:57 字数 202 浏览 10 评论 0原文

我有一堆不同的 WAV 格式的录音(所有不同的乐器和音高),我想“标准化”它们,以便它们在播放时听起来音量大致相同。

我尝试过测量平均样本量(所有绝对值的总和除以样本数),但是通过这种测量进行归一化效果不佳。 我认为这种方法不起作用,因为它没有考虑声音的频率,而且我知道高频录音听起来比相同幅度的低频声音更响亮。

有谁知道测量声音响度的好方法吗?

I have a bunch of different audio recordings in WAV format (all different instruments and pitches), and I want to "normalize" them so that they all sound approximately the same volume when played.

I've tried measuring the average sample magnitude (the sum of all absolute values divided by the number of samples), but normalizing by this measurement doesn't work very well. I think this method isn't working because it doesn't take into account the frequency of the sounds, and I know that higher-frequency recordings sound louder than lower-frequency sounds of the same amplitude.

Does anyone know a good method for measuring the loudness of a sound?

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

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

发布评论

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

评论(5

熊抱啵儿 2024-07-31 08:17:57

均方根通常用于估计声音文件的响度。 这是因为如果声音很短,那么很大声的声音可能不会被感知。 还要记住,功率随着幅度的平方呈指数增加。

Hydrogen Audio 的音频极客对这些东西了解很多...查看他们的免费 重放增益软件。 您可能根本不需要进行任何编程。

编辑:包括关于功率与幅度的评论反馈。

Root Mean Square is often used to estimate the loudness of sound files. This is because a sound that is very loud might not be perceived that way if it is very short. Also remember that power increases exponentially with the square of amplitude.

The audio geeks at Hydrogen Audio know a ton about this stuff...check out their free Replay Gain software. You may not need to do any programming at all.

EDIT: Included comment feedback on power vs. amplitude.

眼眸印温柔 2024-07-31 08:17:57

要添加到 PeterAllenWebb 的响应中:

在计算 RMS 之前,您应该首先将样本“居中”(考虑一个 5 分钟的 .wav,其中每个样本都具有最大+振幅)。 最好的方法是使用亚音速的高通滤波器。

这仍然没有考虑人类敏感的频率。 为此,您可以使用 A 加权。 有一个页面可以在线计算:
http://www.diracdelta.co.uk/ science/source/a/w/aweighting/source.html

代码似乎在这里:
http://www.diracdelta.co.uk/科学/源/a/w/aweighting/multicalc.js

To add to PeterAllenWebb's response:

Before you calculate the RMS, you should "center" your sample first (think of a 5-minute .wav where each sample has the maximum +amplitude). The best way to do that is to use a highpass filter at a subsonic frequency.

That would still not take the frequencies that humans are sensitive to in count. To do that, you could use A-weighting. There's a page where you can calculate it online:
http://www.diracdelta.co.uk/science/source/a/w/aweighting/source.html

The code seems to be here:
http://www.diracdelta.co.uk/science/source/a/w/aweighting/multicalc.js

各空 2024-07-31 08:17:57

好吧,不是音频专家,并且添加到之前的评论中,您应该弄清楚您定义的“峰值功率的最短时间”,然后将波形转换为原始浮点并在一段时间内使用 RMS并连续获取该时间长度的大部分,找到最大值,然后就得到了最高峰值功率。

Well not being an expert on audio and adding to the previous comment, you should figure out what you define as the "shortest amount of time for peak power" and then just convert the wave to raw floating point and use RMS over the stretch of time and continuously take chunks of that length of time, find the MAX and there you have your highest peak power.

风和你 2024-07-31 08:17:57

重申一下其他人所说的,使用 RMS 值来估计一段声音的“响度”。

但是,如果您正在处理诸如拨弦或鼓敲击之类的脉冲声音,您可能需要滑动 RMS 值并仅选取峰值 RMS 值。 测量 100 ms 的声音,滑动窗口,再次测量等,然后根据找到的最大值进行归一化。

在进行 RMS 之前,一定要删除任何 DC 值,A 计权将使它更像我们听到的声音。 以下是 MATLAB/OctavePython

To reiterate what some other people have said, use RMS value to estimate the "loudness" of a passage of sound.

But, if you're dealing with impulsive sounds like plucking or drum hits, you'd want to do a sliding RMS value and pick out only the peak RMS value. Measure 100 ms of the sound, slide the window, measure again, etc. and then normalize according to the largest value you find.

Definitely remove any DC value before doing the RMS, and A-weighting will make it more like how we hear. Here's code for A-weighting in MATLAB/Octave and Python.

云雾 2024-07-31 08:17:57

我可能离这里很远,但是,如果你有wavepad,你可以加载多个文件并稍微弄乱卷,这样它们都是一样的。 此外,如果文件的某些部分声音较大,您可以选择该部分并降低该部分的音量。

编辑:抱歉,这并不是真正的测量体积的“方法”,但如果您只需要使它们全部相同,那么这应该可以正常工作。

I might be way off here, but, if you have wavepad you can load in multiple files and mess with the volumes a little bit so they are all the same. Also, if you have certain sections of a file that are louder, you can select that section and lower the volume for that one section.

EDIT: And sorry, it;s not really a "method" for measuring volume, but if you just need to make them all the same this should work fine.

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