This is a simple tutorial to explain how to separate drums, piano sound from songs. To do this, here I will use a simple command line tool that takes a song file from you and then identified various signs in it and can even separate them. It creates separate WAV files for the extracted drum and piano sounds and then you can do whatever you want. In order to do this, you just need to execute a simple command and it will do the heavy lifting for you. The best part about this is that it uses neutral networks to identify the drum and piano sounds.
If you want to intelligently separate instrument sounds from any given audio file then you are at the right plane. The tool which does this is called Spleeter. This is an open source tool and use machine leaning approach to analyze a given music track. And you can then use it to extract the drum, piano, vocals like music from the song. It takes an MP3 file and create a separate WAV file for the extracted drum and piano signals. The accuracy of the tool is very good and I think it should work fine on every kind of song.
How to Separate Drums, Piano Sound from Songs?
You can install this easily on your machine using Anaconda. If you don’t have Anaconda then you can see the installation command on its GitHub page. After cloning this, you can activate the environment by running the following command then you are all ready to use it.
conda activate spleeter-cpu
I am using the sample audio file included in the project. The main command to execute this is below. Here you can replace my audio file with the one that you want it to process. After that, let it just process the input song and then let it extract the piano and drums sound for you. The process may take a few minutes depending on the size of the input audio file. And when it is done, you can access the generates WAV in the output folder.
spleeter separate -i audio_file -o audio_output -p spleeter:5stems
You can see the four files that it created in my case. You can play the WAV file corresponding to the drum and piano and see if it worked perfectly. In this way, you can use this simple command tool to extract drum and piano sound from any music track. Just process any song with it and you can share your experience. If you are interested in the technical aspects of this tool then you can see its GitHub page.
Sounds of music instruments can be extracted manually with some audio processing techniques and but that takes time. There are some automated and intelligent tools for it, but they are mostly paid. Which is why, I really liked it and the best part is that it is open source and uses machine learning. You just follow this post and install it and use it on various kind of songs.