Separating audio components using Independent Component Analysis
Separating components of music has been a challenging problem for DJs, music producers, and the
karaoke industry. Given a song, often it is desired to isolate the audio to treat each instrument track
separately and try different mixes of instruments and beats. Karaoke service workers also need separate
the vocal track from the instruments.
There are some tools already available for doing this task, but separation is often time-consuming and
results are imperfect. We try to create a tool based on Independent Component Analysis (ICA) for
separating the different audio signals from the instruments from each other. Whether you work in the
music industry or are just trying to have some fun creating your own lo-fi beats, this post is for you! We
will introduce you to the basics of ICA and walk you through some examples so that you can apply it to
your own songs.
Independent Component Analysis is a computational method for separating multiple signals into
subcomponents. For the method to work, the components (also called sources) need to be independent
and non-gaussian. Instrumental audio components meet both requirements, which is our motivation for
trying method in this particular problem.
In our example, we have some audio mixtures of different instruments containing multiple
components, which are going to be separated using ICA. In this particular problem, there have to be as
many recorded tracks as there are components (instruments) that are desired to separate. This limits
the use of the product to some extent, as in some cases there is only one available track recording with
all the instruments combined into one song.
However, in music studios, usually different microphones are used
to record the different instruments/components. For example, when recording a song, the vocal track
is recorded with its own microphone, guitar and bass are recorded with their own microphones, and so
on.
In summary, our tool for separates the different instruments from the mixed tracks,
for example for karaoke use or DJ purposes. Now, let’s get into it!
How to use the tool?
Here, we will walk you through the separation process and provide an example of how we separate the
tracks from the recordings of a full ban.
Note: You will need to have Python3 installed, with following packages: numpy, sklearn, scipy and
matplotlib.
1. Download the software
Open the terminal and navigate to the folder where you desire to download the package. Then,
copy the following line to your command line and the installation should start.
git clone https://github.com/vitoriapacela/sound_ica.git
2. Prepare your audio tracks
Once installed, navigate to the sound_ica directory and create a new folder for the audio tracks that you
are willing to process. Copy your audio tracks to the folder. For the audios we will separate in this
example, I created a folder called “my_audios” and moved the original tracks there.
In this example, we will separate different instruments from a studio recording. The original tracks
contain six different components: guitars, bass, keyboard, back and lead vocal tracks. Here is an
example of one of the mixed tracks that we are going to use for the separation:
And here you can visualize how the audio signal looks like:
When the tracks are in the folder, we are good to go!
3. Run the ICA separation program
For running the tool, navigate to the sound_ica folder in your terminal. Then
execute the following line:
python3 ica-n-components.py my_audios
Where ”my_audios” is the name of the folder containing your audios.
4. Get separated audios
After running the program, separated audios be in the “estimated_sources” folder inside your audios
folder. Let's have a listen to our freshly separated components, we can identify which instrument each
one is:
And here are the visualizations of their respective audio signals:
From those, we can see that, for example, the drums have a sparse audio signal with a few peaks, while
most of the instruments are playing continuously throughout the song.
We can notice that the separation works very well!
Next, feel free to try with your own audios.


Kommentit
Lähetä kommentti