Irregular Click Track

How far out does a regular rhythm need to be to noticeably sound like it is out of time?

This bit of code creates a “regular” click at the specified tempo, but the exact time of each beat is shifted by a small random amount.
Note: THIS IS NOT A COMPLETEPLUG-IN (though it could easily be converted into one).

To run this code, select part of an empty track, then select the Nyquist Prompt effect from the Effect menu. Copy and paste this code into the Nyquist Prompt text box and click “OK”.

(setq variance 10 )  ; maximum variation in time (0 to 100 ms)
(setq tempo 120)  ; tempo bpm
(setq NumberOfBeats 16)
(setq amplitude 0.5)  ; amplitude of click (0 to 1)

(defun randtime (time)
  (mult 2.0 time (- (rrandom) 0.5)))

(defun vari-click ()
  (abs-env
    (let* ((click (lowpass2 (highpass8 (noise 0.01) 100) 2000 1000))
           (click (mult click (/ amplitude (peak click 1000))))
           (output click)
           (v (min (/ variance 1000.0) 0.1))
           (beat (/ 60.0 tempo)))
      (dotimes (i (1- (truncate NumberOfBeats)))
        (setf output
          (sim output
            (at (+ (* (1+ i) beat)(randtime v)) (cue click)) )))
      output)))

; for stereo: (vector (vari-click)(vari-click))
(vari-click) ; mono click track

The first line sets the maximum amount that each click may be shifted. It is currently set for +/- 10 milliseconds.
To make the rhythm less regular, increase the value of “variance”, for example, try changing the first line to:

(setq variance 30 )

You should be able to hear that the click tempo is irregular, though it still has an average tempo close to the tempo specified in the second line.