Skip to main content

onsetdetection

onsetdetection(
@method 'hfc'
@samplerate 44100
@mode 1
) -> llll

Generates an audio descriptor to compute buffer onsets, given various onset detection functions.

The resulting buffer will be updated with the following keys:

  • onsetdetection
info

onsetdetection is a mirror implementation of the same algorithm in the Essentia library. For more details on the algorithm, please check the Essentia Algorithms reference.


Arguments

  • @method [list]: The method used for onset detection. (default: 'hfc').
    • 'hfc': High frequency content.
    • 'complex': The complex-domain spectral difference function.
    • 'complex_phase': The simplified complex-domain spectral difference function taking into account phase changes, weighted by magnitude.
    • 'flux': Spectral flux.
    • 'melflux': Similar to spectral flux, but using half-rectified energy changes in Mel-frequency bands.
    • 'rms': Difference function, measuring the half-rectified change of the RMS of the magnitude spectrum.
  • @samplerate [int]: Sampling rate. (default: 44100).
  • @mode [int]: Analysis mode. (default: 1).
    • 0: Global
    • 1: Time series
    • 2: Time-tagged time series
    • 3: Buffer

Output

Onsetdetection descriptor [llll]


Usage

onsetdetection is meant to be used with the analyze function:

$buffer = importaudio('singing.wav'); ## input buffer
$descr = onsetdetection(); ## generate onsetdetection audio descriptor
$buffer.view('before analysis');
$buffer = $buffer.analyze($descr); ## apply analysis
$buffer.view('after analysis')