findOffsets

maelzel.snd.features.findOffsets(onsets, samples, sr, rmscurve=None, silenceThreshold=-60, relativeThreshold=90, rmsperiod=0.05, notfoundValue=-1)[source]

For each onset find its corresponding offset

If no offset is found before the next onset, the corresponding offset time is set to be notfoundValue

Parameters:
  • onsets (list[float] | ndarray) – the onset times

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

  • sr (int) – the samplerate of the samples

  • silenceThreshold – silence threshold in dB

  • relativeThreshold (int) – if the sound falls this amount of dB relative to the onset then it is also considered an offset (possitive dB)

  • notfoundValue – the value used to indicate that no offset was found for a given onset, indicating that a new onset was found before the previous onset was allowed to decay into silence

Return type:

list[float]

Returns:

a list of offsets, one for each onset given. An offset is -1 if a new onset is found before any silence is found