filterOnsets

maelzel.snd.features.filterOnsets(onsets, samples, sr, minampdb=-60, rmscurve=None, rmsperiod=0.05, onsetStrengthBpf=None)[source]

Returns a selection array where a value of 1 marks an onset as relevant

The returned array can be used to remove superfluous onsets, based on secondary features (rms, …)

Parameters:
  • onsets (ndarray) – the list of onsets

  • samples (ndarray) – the samples for which these onsets where calculated

  • sr (int) – the sample rate of the samples

  • minampdb – the min. amptliude of audio in order for an onset to be valid (in dB)

  • rmsperiod – the period in seconds to use for calculating the RMS

  • rmscurve (Optional[BpfInterface]) – an rms curve can be given if it has been already calculated.

  • onsetStrengthBpf (Optional[BpfInterface]) – the onset strength as returned by the onsets() function

Return type:

ndarray

Returns:

a tuple (onsets selection array, rmscurve), where the array is of the same size of onsets. For each onset a value of 1 marks the onset as relevant, a value of 0 indicates that the onset might be superfluous. During the filtering a rms curve is calculated. This curve is returned to the user, who might use it later (for example, to calculate the offsets via findOffsets()

Example

TODO!!!