1 Get a window of data: *s[i], i=0,w-1* (*w* is
the windowsize)

**2** apply a high pass filter to the data (clicks contain a
lot of high frequency amplitudes)

**3** Compute *hpf_mean =* mean of *hpf[]*
vector.

**4** Moving *backwards (j=i, i-50)* through the windowed
data, compute the first derivative *dy[j]* of the change
in hpf[] from hpf[j+1] to hpf[j-1]

**5** Compute *dy_mean = mean(dy[]), dy_stddev =
stddev(dy[])*

**6** If *dy[j]* > 2.00**dy_stddev / sensitivity+dy_mean
&& hpf[j] > 2.0*mean_hpf / sensitivity* then it's the start
(end, that is) of a click.

**7** If *hpf[j] < 2.0*mean_hpf / sensitivity*
then it's the end (start, that is) of a click.

The gymnasitics of looking at the means and standard deviations of the region around the sample of interest is to make the click detector smart and not get fooled by normal high frequency audio (like a cymbal crash), which is fairly long in duration, in essence, we're looking for outliers in thesensitivityis a factor that is set to make the detector more or less sensitive to click detection.