Skip to main content

onsetdetection

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

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

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.inspect('before analysis');
$buffer = $buffer.analyze($descr); ## apply analysis
$buffer.inspect('after analysis')