Reputation: 15
I'm trying to set the rms level of an AudioSegment in Pydub relative to another file, before overlaying the two. 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. 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.
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?
Upvotes: 1
Views: 358
Reputation: 95911
I understand that apply_gain
returns a modified copy of the audio segment.
So you probably must do:
segmentTwo = segmentTwo.apply_gain(gain)
Upvotes: 1