extract human vocals from song

ashish picture ashish · Mar 14, 2018 · Viewed 13k times · Source

my question is about how to proceed in extracting human voice in music using the language python i have gone through this code but it extracts background music

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")

i need to extract human voice in song

if not this then how to subtract one audio file from another audio file

Answer

Chetan Kandpal picture Chetan Kandpal · Sep 7, 2018

You can always use the librosa library, which is favorite library for audio processing in python. It can be helpful in separating vocals (and other sporadic foreground signals) from accompanying instrumentation.

https://librosa.github.io/librosa_gallery/auto_examples/plot_vocal_separation.html

It takes the slice and plot the same slice, but separated into its foreground and background