NMFFilter

Decomposes and resynthesises a signal against a set of spectral templates

Pointer

NMFFilter is designed to work with bases taken from a BufNMF analysis. Please visit the BufNMF page to learn about bases before proceeding.

NMFFilter splits an incoming audio signal into different audio streams based on a set of spectral templates provided by the user (such as bases from a BufNMF analysis). It does this by performing non-negative matrix factorisation on a single spectral frame using the provided bases as seeds. Learn more about the seeding process in the Seeding NMF Overview.

One stream of audio is split into three streams based on three spectral templates provided to NMFFilter.

Example Code


In this example, we’ll use the bases from the analysis on the BufNMF page. These bases contain spectral templates for the (1) kick drum, (2) snare drum, and (3) hi-hat components of the original drum loop.

The original drum loop used to derive the bases from a BufNMF analysis

First, let’s send the original drum loop through NMFFilter in real-time using the bases derived from the drum loop analysis.

Audio stream output based on basis 1:

The output audio of the original drum loop filtered by basis 1 in NMFFilter

Audio stream output based on basis 2:

The output audio of the original drum loop filtered by basis 2 in NMFFilter

Audio stream output based on basis 3:

The output audio of the original drum loop filtered by basis 3 in NMFFilter

This will give us very similar sounding results as BufNMF’s resynthesized buffer–the difference here is that results are produced in real-time. This means that one could send a live input of this drummer and (hopefully) get similarly successful results decomposing the drum loop into the individual drum instruments in real-time.

Audio Input From a Different Source

One could also send a different audio signal through these bases using NMFFilter. Here we’ll use an excerpt from an ensemble recording that also has kick drum, snare drum, and hi-hat.

Original ensemble recording:

Source ensemble recording.

Audio stream output based on basis 1:

The output audio of the ensemble recording filtered by basis 1 of the drum loop BufNMF analysis

Audio stream output based on basis 2:

The output audio of the ensemble recording filtered by basis 2 of the drum loop BufNMF analysis

Audio stream output based on basis 3:

The output audio of the ensemble recording filtered by basis 3 of the drum loop BufNMF analysis

NMFFilter has relatively well separated the hi hat, kick drum, and snare drum sounds in this song, because those are the bases from the drum loop. One can hear other sounds from the song mixed into these streams as well, as all of the sound from the original will be represented somewhere in these output streams.

Filtering Noise

Sending some pink noise through NMFFilter can provide another way of hearing and thinking about what it offers. Below are short clips of steady volume pink noise going through the three bases used above.

Pink noise filtered by basis 1 of the drum loop BufNMF analysis
Pink noise filtered by basis 2 of the drum loop BufNMF analysis
Pink noise filtered by basis 3 of the drum loop BufNMF analysis

One can hear that the noise is filtered by the spectral templates of the bases (seen below as spectra).

The bases used above seen as spectra. x axis = FFT bins; y axis = magnitudes