Sound Design Toolkit  078
Physically informed sound synthesis for everyday sounds
SDTDemix.h: Transient/tonal/residual components separator

Typedefs

typedef struct SDTDemix SDTDemix
 Opaque data structure for the percussive/harmonic/residual components separator.
 
typedef struct SDTDemix SDTDemix
 Opaque data structure for the percussive/harmonic/residual components separator.
 

Functions

SDTDemixSDTDemix_new (int size, int radius)
 Object constructor. More...
 
void SDTDemix_free (SDTDemix *x)
 Object destructor. More...
 
void SDTDemix_setOverlap (SDTDemix *x, double f)
 Sets the window overlapping factor. More...
 
void SDTDemix_setNoiseThreshold (SDTDemix *x, double f)
 Sets the noise threshold. More...
 
void SDTDemix_setTonalThreshold (SDTDemix *x, double f)
 Sets the tornal threshold. More...
 
void SDTDemix_dsp (SDTDemix *x, double *outs, double in)
 Signal processing routine. Call this function at sample rate to separate an arbitrary signal into its percussive/harmonic/residual components. More...
 

Detailed Description

This algorithm looks for vertical and horizontal structures in the spectrogram to separate an arbitrary audio signal into its percussive (transients), harmonic (sustained tones) and residual (noise) components. It is based on a technique called structure tensor, frequently used in image processing for edge and corner detection or to estimate the orientation of an object.

The structure tensor can be thought as a smoothed gradient of the spectrogram, which describes the consistency and direction of changes in the energy content of each bin. The anisotropy (consistency) and direction descriptors extracted from the structure tensor are used to classify the spectrogram bins into three categories: Bins which do not exhibit a particular gradient direction (low anisotropy) become part of the residual, noisy component; Bins which tend to have a vertical orientation (high anisotropy, high direction) are included in the percussive component; Bins with a mostly horizontal orientation (high anisotropy, low direction) fall into the harmonic component.

This percussive/harmonic/residual separation is suitable to separate attacks, decays and noise from a musical signal, or to isolate myoelastic (percussive), phonatory (harmonic) and turbulent (noisy) activities from a vocal signal. In particular, the algorithm can be used as a preprocessing step to improve the results of the myoelastic detector, pitch tracker and spectral moments extractor present in the analysis part of the Sound Design Toolkit.

Function Documentation

void SDTDemix_dsp ( SDTDemix x,
double *  outs,
double  in 
)

Signal processing routine. Call this function at sample rate to separate an arbitrary signal into its percussive/harmonic/residual components.

Parameters
[out]outsPointer to a 3-elements output array. outs[0] is the percussive component, outs[1] is the harmonic component and outs[2] is the residual.
[in]inInput sample
void SDTDemix_free ( SDTDemix x)

Object destructor.

Parameters
[in]xPointer to the instance to destroy
SDTDemix * SDTDemix_new ( int  size,
int  radius 
)

Object constructor.

Parameters
[in]sizeAnalysis window length, in samples
[in]radiusSmoothing kernel radius, in samples
Returns
Pointer to the new instance
void SDTDemix_setNoiseThreshold ( SDTDemix x,
double  f 
)

Sets the noise threshold.

Parameters
[in]fAmount of signal falling into the residual category
void SDTDemix_setOverlap ( SDTDemix x,
double  f 
)

Sets the window overlapping factor.

Parameters
[in]fWindow overlapping factor
void SDTDemix_setTonalThreshold ( SDTDemix x,
double  f 
)

Sets the tornal threshold.

Parameters
[in]fAmount of non-residual falling into the tonal category