[英]Setting rms relative to another audio file using Pydub
I'm trying to set the rms level of an AudioSegment in Pydub relative to another file, before overlaying the two.在覆盖两个文件之前,我试图设置 Pydub 中 AudioSegment 相对于另一个文件的 rms 级别。 The method I'm trying to use involves setting the relative rms of the first file to be +4 dB more intense than the second- I know rms isn't modifiable, but dBFS is.我尝试使用的方法涉及将第一个文件的相对 rms 设置为比第二个文件强 +4 dB - 我知道 rms 不可修改,但 dBFS 是。 I'm trying to modify it with apply_gain()
, but printing the rms and the dBFS doesn't show any differences before and after calling that method.我正在尝试使用apply_gain()
修改它,但是在调用该方法之前和之后打印 rms 和 dBFS 没有显示任何差异。
At the moment, my code looks something like:目前,我的代码如下所示:
if segmentOne.dBFS > segmentTwo.dBFS:
gain = segmentOne.dBFS - segmentTwo.dBFS
segmentTwo.apply_gain(gain)
elif segmentOne.dBFS < segmentTwo.dBFS:
gain = segmentTwo.dBFS - segmentOne.dBFS
segmentOne.apply_gain(gain)
segmentOne.apply_gain(6)
segmentOne = segmentOne.overlay(segmentTwo)
I'm not very experienced with audio (at all), so it could be there's something obvious I'm missing.我对音频(根本)不是很有经验,所以可能有一些明显我遗漏的东西。 Is there a way of doing what I need using Pydub?有没有办法使用 Pydub 做我需要的事情?
I understand that apply_gain
returns a modified copy of the audio segment.我知道apply_gain
返回音频段的修改副本。
So you probably must do:所以你可能必须这样做:
segmentTwo = segmentTwo.apply_gain(gain)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.