MedianSeparation:
Filter:
sc3-plugins/Classes (extension) | UGens > Analysis | UGens > FFT

MedianSeparation
ExtensionExtension

Separate harmonic and percussive parts of a signal

Description

Implementation of source separation model outlined in:

Derry FitzGerald (2010) "Harmonic/Percussive Separation using Median Filtering" International Conference on Digital Audio Effects (DAFx)

The algorithm can work quite effectively, though you may hear spectral artefacts in the reconstruction depending on the nature of your input signal. Try it on piano sounds to hear really beautiful separation. There are various parameters to the analysis, and I've generalised the original algorithm a little, allowing mean separation as well as median (which is much cheaper CPU cost). Higher quality separation necessarily requires greater latency in calculation.

Class Methods

.new

fft, fftharmonic, fftpercussive, fftsize=1024, mediansize=17, hardorsoft=0, p=2, medianormax=0

Arguments:

fft

Audio input to track, which has been pre-analysed by the FFT UGen; see examples below

fftharmonic

Output FFT buffer for writing the harmonic part

fftpercussive

Output FFT buffer for writing the percussive part

fftsize

The algorithm needs to know the FFT size at constructor time, so pass it in here (all of the buffers for the previous three input arguments should have this size).

mediansize

How many FFT frames and bands to take a median over. The median in the horizontal direction (strength of tonal consistency, harmonic element) is compared to that in the vertical (percussiveness) to determine if a particular spectral bin will belong to the harmonic or percussive reconstruction.

hardorsoft

A flag, 0 for hard, 1 for soft. Hard separation is an either/or for allocation; soft allows a blended sound based on the relative levels of horizontal versus vertical. Each may lead to artefacts, experiment.

p

A factor from the paper for the soft assignment. Default of 2 is the paper default; 1 would be a linear proportional assignment.

medianormax

Defaults to using median algorithm, but a lower CPU cost mean (average) can be used via this argument.

Examples