我想隔离人声并删除mp3文件中的背景音乐。我不需要完全摆脱背景音乐,但至少可以将其最小化。
我尝试了pydub
,它可以帮助进行音频操作。我尝试了该代码,该代码删除了人声和KEEPS背景音乐。我需要做相反的事情。我尝试切换单声道声音并反转另一个声道,但这也不起作用。
from pydub import AudioSegment
from pydub.playback import play
# read in audio file and get the two mono tracks
sound_stereo = AudioSegment.from_file(myAudioFile, format="mp3")
sound_monoL = sound_stereo.split_to_mono()[0]
sound_monoR = sound_stereo.split_to_mono()[1]
# Invert phase of the Right audio file
sound_monoR_inv = sound_monoR.invert_phase()
# Merge two L and R_inv files, this cancels out the centers
sound_CentersOut = sound_monoL.overlay(sound_monoR_inv)
# Export merged audio file
fh = sound_CentersOut.export(myAudioFile_CentersOut, format="mp3")
有人知道解决方案是什么吗?谢谢!
答案 0 :(得分:1)
如果您的sound_CentersOut
已经删除了人声,为什么不使用sound_stereo
的倒置形式对sound_CentersOut
进行相位抵消?
# invert sound_CentersOut
sound_CentersOut_inv = sound_CentersOut.invert_phase()
# phase cancellation on original stereo with inverted sound_CentersOut
# the vocals should remain
vocals = sound_stereo.overlay(sound_CentersOut_inv)
请注意,大多数歌曲的中央都会带有人声和低音,因此您的人声中也可能包含低音。如果您真的想进行手术,则可能需要进行一些EQ运算以滤除较低的频率。