Insert audio clip into track at regular intervals

The task:
You have a long file and you want to insert an audio clip multiple times into the long track at regular intervals.
For example, you may have a short clip containing the word “Demo” that you want to insert every 30 seconds.

This code can be run from the Nyquist Prompt:

;type tool
(setf interval 2.5)  ;interval in seconds.
(let ((end (get '*selection* 'end)))
  (setf end (* interval (truncate (/ end interval))))
  (when (= end (get '*selection* 'end))
    (setf end (- end interval)))
  (do ((t0 end (- t0 interval))
       (i 0 (1+ i)))
      ((or (> i 10)(<= t0 0)))
    (aud-do (format nil "SelectTime: start=~s end=~s"
                    t0 t0))
    (aud-do "Paste:")))

To use the code:

  1. Select and copy the audio clip that will be inserted.
  2. Select the long track
  3. Run the code.