Reverse Using "Get Duration" In "Reverso"

I managed to find this code;

;nyquist plug-in
;version 1
;type process
;name "Reverso..."
;action "Processing..."
;info "by Steve Daulton (http://easyspacepro.com). Released under GPL v2.\n"

;; reverso.ny by Steve Daulton June 2011
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 

;control clipsec "Section Length (seconds)" real "" 0.75 0.1 2

;; 'Window' envelope to cross-fade sound clips
(defun win (dur)
  (let ((step (hz-to-step(/ 2.0 dur))))
    (abs-env
     (mult 0.5 (sim 1
      (at 0 (cue
        (osc step (/ dur 4.0) *sine-table* -90)))
      (at (/ dur 4.0)
        (cue (control-srate-abs *sound-srate* (const 1 (/ dur 2.0)))))
      (at (* dur 0.75)(cue
        (osc step (/ dur 4.0) *sine-table* 90))))))))

(defun reverso (s-in cl)
  (do* ((maxcount (truncate (/ len (* 0.75 cl))))
        (lastbit (truncate (- len (* maxcount (* 0.75 cl)))))
        (hcl (round (* cl 0.75)))
        (temparray
          (snd-fetch-array s-in cl hcl)
          (if (< count (1- maxcount))
            (setq temparray (snd-fetch-array s-in cl hcl))
            (setq temparray (snd-fetch-array s-in lastbit hcl))))
        (temp2 (make-array cl))
        (tempsound (s-rest 0))
        (newsound (s-rest 0))
        (count 0 (setq count (1+ count))))
        ((not temparray) newsound)
    (if (= count maxcount)
      (progn
        (setf temp2 (make-array lastbit))
        (setq cl lastbit)))
    (dotimes (i cl)
      (setf (aref temp2 i)(aref temparray (- cl i 1))))
    (setf tempsound (snd-from-array 0 *sound-srate* temp2))
    (setf newsound (sim
      (at-abs 0 (cue newsound))
      (at-abs (* count (* clipsec 0.75))(cue (mult tempsound (win clipsec))))))))

(cond 
  ((< clipsec 0.1)
    (format nil "Error.\nSection Length must be at least 0.1 seconds."))
  ((> clipsec (get-duration 1))
    (format nil "Error.\nSection Length is set longer than the selected audio."))
  (T
    (setq cliplen (truncate (* clipsec *sound-srate*))) ; clip length in samples
    (multichan-expand #' reverso s cliplen)))

I was trying to set the value from “0.75” to “get-duration” so it selects all of the selected (or all of the audio), with no luck. It does nothing when I try, but the reason I want to reverse the audio like this is so I can combine a speed effect and make a “Fix rewinding” effect, correcting fast and backward to normal and forward (manually adjust speed to a slower speed and reverse to do so). Could you give me some info on how to select the entire audio clip and reverse it in NY using the required code? Instead of a few seconds of reverse, I want to change that few seconds to the duration of the selection or the entire clip.

Please, Help? Thank you.

There’s a limit to how big an array can be, and the effect works by loading sound into an array, reversing the array, then converting it back to a sound.

A “Macro” would probably be better. See: https://manual.audacityteam.org/man/macros.html
The full list of available commands (though a few are not suitable or available for use in macros) is here: https://manual.audacityteam.org/man/scripting_reference.html
“Reverse” and “Change Speed” are available.

The problem with that is I can’t set it manually, and let’s say one file had rewinding sound at 4x speed, another at 10x, another at 5x, another at 16x, and another at 8x; how would I adjust it, so it moves the right speed? If it was 4x faster, I could set it to a quarter of speed, or a tenth for 10x. After that, try to reverse it automatically.

Any suggestions for combining variable speed correction and reverse?

If you are setting the “speed correction” manually, why not do that part as a separate step and use “Change Speed” in the normal way?