Created
March 23, 2015 19:43
-
-
Save jmcmellen/5ff5cb47fdbdf3b9e668 to your computer and use it in GitHub Desktop.
Using pydub to mix and tag promos with bed music
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pydub import AudioSegment | |
from pydub import playback as player | |
import math | |
raw_promo = AudioSegment.from_mp3("FreshA7__1500.mp2") | |
tag = AudioSegment.from_wav("FA_tag2.wav") | |
tag_adjust = round(20 * math.log10(float(raw_promo.rms) / tag.rms), 1) | |
tag = tag + tag_adjust | |
print tag_adjust | |
print len(tag) | |
print "Promo", raw_promo.rms | |
print "Tag", tag.rms | |
promo = raw_promo[:21500] | |
bed = raw_promo[21500:].fade(to_gain=-14.0, start=0, duration=1500) | |
bed = bed.fade(to_gain=14.0, start=5000, duration=1500) | |
bed = bed.overlay(tag, position=1500) | |
player.play((promo+bed) - 3) | |
finished_promo = promo+bed | |
finished_promo.export("FA_finished_promo.wav", format="wav") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment