Skip to main content

effectiveduration

effectiveduration(
@thresholdratio 0.02
@samplerate 44100
) -> llll

Generates an audio descriptor to compute the effective duration of an envelope signal. The effective duration is a measure of the time the signal is perceptually meaningful. This is approximated by the time the envelope is above or equal to a given threshold and is above the -90dB noise floor. This measure allows to distinguish percussive sounds from sustained sounds but depends on the signal length. By default, this algorithm uses 40% of the envelope maximum as the threshold which is suited for short sounds. Note, that the 0% thresold corresponds to the duration of signal above -90db noise floor, while the 100% thresold corresponds to the number of times the envelope takes its maximum value.

The resulting buffer will be updated with the following keys:

  • effectiveduration
info

effectiveduration 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

  • @thresholdratio [int/float]: Ratio of the envelope maximum to be used as the threshold. (default: 0.02).
  • @samplerate [int]: Sampling rate. (default: 44100).

Output

Effectiveduration descriptor [llll]


Usage

effectiveduration is meant to be used with the analyze function:

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