Skip to content

Instantly share code, notes, and snippets.

@Dobby233Liu
Created July 16, 2022 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dobby233Liu/02e9e4f75a543df1a3a3e3087052213d to your computer and use it in GitHub Desktop.
Save Dobby233Liu/02e9e4f75a543df1a3a3e3087052213d to your computer and use it in GitHub Desktop.
true
from pydub import AudioSegment
org = input("org file : ")
out = input("out file : ")
aud = AudioSegment.from_file(org)
channels = aud.split_to_mono()
for i in range(0, len(channels), 2):
l_sub_r = channels[i].overlay(channels[i + 1].invert_phase())
r_sub_l = channels[i + 1].overlay(channels[i].invert_phase())
channels[i], channels[i + 1] = l_sub_r, r_sub_l
aud = AudioSegment.from_mono_audiosegments(*channels)
aud.normalize()
aud.export(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment