Confused about halved durations with Xmusic patterns

I’m trying this slight modification from an Xmusic book example:

(defun pat-ctrl (durpat valpat)	(seq (pwl (next durpat) (next valpat)) (pat-ctrl durpat valpat)))
(abs-env (pat-ctrl (make-cycle (list 1 3)) (make-cycle (list 0.5 -0.5 0.8 -0.2))))

But the durations I’m getting are halved from what I’d expect, i.e. the “1” last half a second and the “3” lasts 1.5 seconds. No idea why… :confused:

If I run that code in the Nyquist Prompt exactly as written, the durations are 1/20th of the specified duration. This is because PWL generates at a sample rate 20 times lower than the default sound-srate. To get the specified durations, I can do this:

(defun pat-ctrl (durpat valpat)
	(seq (pwl (next durpat) (next valpat))
       (pat-ctrl durpat valpat)))

(abs-env
  (control-srate-abs *sound-srate* 
    (pat-ctrl (make-cycle (list 1 3))
              (make-cycle (list 0.5 -0.5 0.8 -0.2)))))

Also, unless you are relying on a bug in an old version of Audacity, you need some way to tell the code to stop.
Example:

;type generate

(defun pat-ctrl (durpat valpat)
  (seq (pwl (next durpat) (next valpat))
       (pat-ctrl durpat valpat)))

(mult (control-srate-abs *sound-srate* (const 1 20))
      (pat-ctrl (make-cycle (list 1 3))
                (make-cycle (list 0.5 -0.5 0.8 -0.2))))