Professional Documents
Culture Documents
Separate vocals from a track using python - DEV Community
Separate vocals from a track using python - DEV Community
Vicente G. Reyes
Posted on 13 févr. 2023
What I've planned to do in the past was learn how to separate vocals from a track
programmatically and not depend on software-as-a-service to perform the separation
of vocals from a track. This article shows how to separate the vocals of a song from
the instruments using my new favorite library, Librosa. You can check out the Google
Colab Notebook here.
The idea sparked when I wanted to separate individual tracks of a song, so I went to
Product Hunt and discovered melody ml. This discovery started the urge to learn ML
for music, hence the discovery of the Python library, librosa.
GIF
https://dev.to/highcenburg/separate-vocals-from-a-track-using-python-4lb5 1/9
17/03/2024 03:06 Separate vocals from a track using python - DEV Community
Icen Reyes
@icenreyes · Follow
Read more on X
import librosa
from librosa import display
import numpy as np
import IPython.display as ipd
import matplotlib as plt
We slice a 20 second snippet in the chorus of the song. We show the audio using
ipd.Audio (tbh, this is a bit exhausting). Photo is shown below because I couldn't find a
way to upload audio here on DEV.
https://dev.to/highcenburg/separate-vocals-from-a-track-using-python-4lb5 2/9
17/03/2024 03:06 Separate vocals from a track using python - DEV Community
https://dev.to/highcenburg/separate-vocals-from-a-track-using-python-4lb5 3/9
17/03/2024 03:06 Separate vocals from a track using python - DEV Community
fig.colorbar(img, ax=ax)
Conclusion
This seemed easy at first thought and when I was reading the documentation but
digging under the code made me realize that this idea was a little more complex. But,
what made me continue was when I read about nearest neighbors in one part of the
documentation which made me realize that I will be getting my hands on Machine
Learning in the future with this library.
https://dev.to/highcenburg/separate-vocals-from-a-track-using-python-4lb5 5/9