Sound Design Toolkit  078
Physically informed sound synthesis for everyday sounds
Spectral audio descriptors

Typedefs

typedef struct SDTSpectralFeats SDTSpectralFeats
 Opaque data structure for a spectral features extractor.
 
typedef struct SDTSpectralFeats SDTSpectralFeats
 Opaque data structure for a spectral features extractor.
 

Functions

SDTSpectralFeatsSDTSpectralFeats_new (unsigned int size)
 Instantiates a spectral features extractor. More...
 
void SDTSpectralFeats_free (SDTSpectralFeats *x)
 Destroys a spectral features extractor. More...
 
void SDTSpectralFeats_setOverlap (SDTSpectralFeats *x, double f)
 Sets the analysis window overlapping ratio. Accepted values go from 0.0 to 1.0, with 0.0 meaning no overlap and 1.0 meaning total overlap. More...
 
void SDTSpectralFeats_setMinFreq (SDTSpectralFeats *x, double f)
 Sets the lower frequency bound for spectral analysis. Spectral bins below this frequency are ignored in the audio descriptors computation. More...
 
void SDTSpectralFeats_setMaxFreq (SDTSpectralFeats *x, double f)
 Sets the upper frequency bound for spectral analysis. Spectral bins above this frequency are ignored in the audio descriptors computation. More...
 
int SDTSpectralFeats_dsp (SDTSpectralFeats *x, double *outs, double in)
 Signal processing routine. Call this function for each sample to perform signal analysis. More...
 

Detailed Description

Spectral features extractor: statistical moments (centroid, spread, skewness, kurtosis), spectral flatness, spectral flux and an onset detection function based on rectified, whitened spectral flux.

Function Documentation

int SDTSpectralFeats_dsp ( SDTSpectralFeats x,
double *  outs,
double  in 
)

Signal processing routine. Call this function for each sample to perform signal analysis.

Parameters
[in]xPointer to the instance
[out]outsPointer to an array of seven doubles, containing the algorithm outputs. Array members represent the following information respectively:
  1. Spectral centroid,
  2. Spectral spread,
  3. Spectral skewness,
  4. Spectral kurtosis,
  5. Spectral flatness,
  6. Spectral flux,
  7. Onset detection function (rectified and whitened spectral flux).
[in]inInput sample
Returns
1 if output available (analysis window full), 0 otherwise
void SDTSpectralFeats_free ( SDTSpectralFeats x)

Destroys a spectral features extractor.

Parameters
[in]xPointer to the instance to destroy
SDTSpectralFeats * SDTSpectralFeats_new ( unsigned int  size)

Instantiates a spectral features extractor.

Parameters
[in]sizeSize of the analysis window, in samples
Returns
Pointer to the new instance
void SDTSpectralFeats_setMaxFreq ( SDTSpectralFeats x,
double  f 
)

Sets the upper frequency bound for spectral analysis. Spectral bins above this frequency are ignored in the audio descriptors computation.

Parameters
[in]xPointer to the instance
[in]fMaximum analyzed frequency, in Hz
void SDTSpectralFeats_setMinFreq ( SDTSpectralFeats x,
double  f 
)

Sets the lower frequency bound for spectral analysis. Spectral bins below this frequency are ignored in the audio descriptors computation.

Parameters
[in]xPointer to the instance
[in]fMinimum analyzed frequency, in Hz
void SDTSpectralFeats_setOverlap ( SDTSpectralFeats x,
double  f 
)

Sets the analysis window overlapping ratio. Accepted values go from 0.0 to 1.0, with 0.0 meaning no overlap and 1.0 meaning total overlap.

Parameters
[in]xPointer to the instance
[in]fOverlap ratio [0.0, 1.0]