Feedback needed for a plugin my friend and I tried to write

So I decided for the very first time to take a go at programming a Nyquist plugin. Because there isn’t a plugin to slide the speed from one percentage to another, I thought I could write a plugin for this. However, I’m sure it doesn’t work, so I would really like your feedback as far as the format of the plugin and especially where to put what. I have only read a bit of the Nyquist manual because to me, it seems rather complicated, but I’ve tried all I could, along with my college classmate friend Brianna “Bri” (who is also really really good at camera and visual stuff), to see if I could possibly get this plugin off the ground. Here’s what we came up with so far. Note that we used the Tremolo Vibrato plugin and the Turntable Warp plugin as a baseline. Maybe the only solution is to start from pure scratch?


;nyquist plug-in
;version 3
;type process
;name “Slide…”
;action “Sliding.”
;info “by Michael Kazmierski and Bri Yaroch.\nSlides from one speed to another, as in the Doppler effect or a machine turning off or on.”

;; Slide.ny - version 3 plug-in (requires Audacity 1.3 or later)
;; by Michael Kazmierski and Bri Yaroch, December 2016
;; Released under terms of the GNU General Public License version 2:
;; .

;control idev “Initial deviation (percent)” real “%” -100 6400 0
;control fdev “Final deviation (percent)” real “%” -100 6400 0
;; Slide function
(setf dur (/ len sound-srate)) (defun slide (s-in idev fdev)
(let* ((bend (mult (env (pwlv idev 1 fdev)))
;; map to sound-time
(map (integrate (db-to-linear bend))) (snd-compose snd (force-srate sound-srate map))))

;;compensate for 95% normalizing and compose signal
(mult (/ 0.95) (snd-resamplev s-in sound-srate map))))

;; Function to generate sweep (defun sweep (idev fdev)
(mult -0.5 (sum 1.0 (env (pwlv idev 1.0 fdev))))

;; error checking
(setq idev
(/ (sanitise idev -20000 20000) 100.0)(/ (sanitise idev -20000 20000) 100.0)))

(setq fdev
(/ (sanitise fdev -20000 20000) 100.0)(/ (sanitise fdev -20000 20000) 100.0)))

(if (or (> idev 20000)(> fdev 20000))
(setq err “Maximum deviation is 20000 %”)
(setq idev (sanitise idev -20000 20000))
(setq fdev (sanitise fdev -20000 20000))))

(if (> (length err) 0)
(format nil “Error.~%~a” err)
(case type
(0 (multichan-expand #’ slide s idev fdev))
(1 ))))

I’m pretty sure it does not work, so again, any feedback is greatly appreciated. I’m aware of others who want a plugin like this one. My guess is that it’s way more complicated than this, but I figured I’d just try first.


Yeah, I know, but I’m blind, and so time tracks are, well, strictly impossible for me.

Your brief seems to be that you want the same as “Turntable Warp” but with settings in percentages rather than semitones.

Some errors in your code:

;control idev "Initial deviation (percent)" real "%" -100 6400 0

The three numbers at the end don’t make sense. See:

;; Slide function
(setf dur (/ len *sound-srate*)) (defun slide (s-in idev fdev)
(let* ((bend (mult (env (pwlv idev 1 fdev)))
;; map to sound-time
(map (integrate (db-to-linear bend))) (snd-compose snd (force-srate *sound-srate* map))))

;;compensate for 95% normalizing and compose signal
(mult (/ 0.95) (snd-resamplev s-in *sound-srate* map))))

It’s easier to see the problem here if you indent lines. (David Sky usually did not indent lines, because he was blind, so indentation made no difference to him).
Here’s the same code, indented to show the structure. Looks like you may have parentheses in the wrong place.

What is ENV? You seem to be using it as a function, but I don’t see it defined as a function anywhere. Perhaps you mean ENV to be a variable rather than a function?

;; Slide function
;; ??? What does this line have to do with the SLIDE function?
(setf dur (/ len *sound-srate*))

(defun slide (s-in idev fdev)
  (let* ((bend (mult (env (pwlv idev 1 fdev))) ;; ??? Do you mean (mult env (pwlc idev fdev))
         (map (integrate (db-to-linear bend)))
         ;; What is this next line doing?
         ;; Perhaps it should be in the body of the LET block?
         (snd-compose snd (force-srate *sound-srate* map))))
  (mult (/ 0.95) (snd-resamplev s-in *sound-srate* map))))

This next part is not a function definition, though the code comment suggests that it should be.
Again you use a function (ENV argument).
There is a function in Nyquist called ENV, but it takes more than one argument (parameter). Perhaps you mean:

;; Function to generate sweep (defun sweep (idev fdev)
(mult -0.5 (sum 1.0 (env (pwlv idev 1.0 fdev))))

There’s a book available (with free download) here:
This book is about a different dialect of LISP called “Common Lisp”, but the first few chapters apply pretty much to any version of LISP. It gives a simple introduction to many of the basic concepts used in LISP. I’d highly recommend reading at least the first half of this book.