I'm trying to create a function that will remove the vocals from the multiple wav files in a folder but keep running into an index error. I am new to python so am not sure where the issue is arising from but i think it might stem from the way i reference the file path in the function call though I can not actually be sure. any suggestions?
from pydub import AudioSegment
from pydub.playback import play
def vocalremover(advertaudio):
sound_stereo = AudioSegment.from_wav(advertaudio)
sound_monoR = sound_stereo.split_to_mono()[1]
sound_monoL = sound_stereo.split_to_mono()[0]
sound_monoR_inv = sound_monoR.invert_phase()
sound_CentersOut = sound_monoL.overlay(sound_monoR_inv)
sound_CentersOut.export(str(advertaudio), format="wav")
vocalremover(r'C:\Users\Jan\OneDrive - Media
Ltd\normalized\201901150009_Proxy.wav')
it returns the error:
IndexError Traceback (most recent call last) in ----> 1 vocalremover(r'C:\Users\Jane\OneDrive - Jeli Media Ltd\clearcast\normalized\201901150009_Proxy.wav')
in vocalremover(advertaudio)
----> 9 sound_monoR = sound_stereo.split_to_mono()[1]
IndexError: list index out of range