Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: differentiate , Previous: delete-props , Up: D , Home: Overview

Clamps Dictionary

detect-onsets

Function

(detect-onsets buffer &key (method :wpd) (fft-size 2048) (hop-size 441) (delta 0.1d0) (alpha 0.9d0) (window 3) (threshold-multiplier 3) (normalization-window 50) (min-inter-onset-interval 0.05d0) (cooldown nil) (amp-threshold -40.0d0) (amp-freq 10) (amp-periods 2) (amp-cooldown 0.2d0) (sample-rate (buffer-sample-rate buffer)))

Detect onsets in an Incudine buffer using spectral onset detection. Returns a list of onset times in seconds. Implements peak-picking from Dixon DAFx-06 section 2.6 with local normalization.

Arguments

:method One of :wpd, :pd, :cd, :cd-hwr, :flux, :flux-hwr, :flux-hwr-l1, :amp.
:fft-size FFT window size (default 2048, ~46ms at 44.1kHz).
:hop-size Hop size in samples (default 441, ~10ms at 44.1kHz).
:delta Threshold above the local mean (default 0.1).
:alpha Decay parameter for the adaptive threshold g (default 0.9).
:window Half-width of the peak-picking window (default 3).
:threshold-multiplier m: mean computed over (m*w + w + 1) frames (default 3).
:normalization-window Hops for local mean/std computation (default 50 = 500ms).
:min-inter-onset-interval Minimum time between onsets in seconds during peak-picking (default 0.05). Use :cooldown for post-filtering instead.
:cooldown If set, post-filters onsets to enforce minimum interval in seconds. Overrides :min-inter-onset-interval for the final output.
:amp-threshold Amplitude threshold in dB for :amp method (default -40.0).
:amp-freq Measurement frequency in Hz for :amp method (default 10).
:amp-periods Number of periods to average for :amp method (default 2).
:amp-cooldown Minimum time between onsets for :amp method (default 0.2).

Author: Orm Finnendahl

Created: 2026-06-14 So 20:01

Validate