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

Using Nyquist scripts in Audacity.
Post and download new plug-ins.

If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like

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

Permanent link to this post Posted by Michael Kazmierski » Thu Dec 15, 2016 4:06 am

Hello,
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?


Slide.ny

;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:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html .

;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 %")
(progn
(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.

Michael
Michael Kazmierski
 
Posts: 33
Joined: Wed Aug 17, 2016 1:06 am
Operating System: Windows 7

Re: Feedback needed for a plugin my friend and I tried to wr

Permanent link to this post Posted by Michael Kazmierski » Thu Dec 15, 2016 5:08 am

Yeah, I know, but I'm blind, and so time tracks are, well, strictly impossible for me.
Michael Kazmierski
 
Posts: 33
Joined: Wed Aug 17, 2016 1:06 am
Operating System: Windows 7

Re: Feedback needed for a plugin my friend and I tried to wr

Permanent link to this post Posted by Trebor » Thu Dec 15, 2016 5:11 am

Michael Kazmierski wrote:... a plugin to slide the speed from one percentage to another ... 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 ...

Your brief seems to be that you want the same as "Turntable Warp" but with settings in percentages rather than semitones.
Last edited by Trebor on Thu Dec 15, 2016 2:31 pm, edited 1 time in total.
Trebor
 
Posts: 3495
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows Vista

Re: Feedback needed for a plugin my friend and I tried to wr

Permanent link to this post Posted by steve » Thu Dec 15, 2016 2:09 pm

Some errors in your code:
Code: Select all
;control idev "Initial deviation (percent)" real "%" -100 6400 0

The three numbers at the end don't make sense. See: http://wiki.audacityteam.org/wiki/Nyqui ... der_Widget

Code: Select all
;; 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?
Code: Select all
;; 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: http://www.cs.cmu.edu/~rbd/doc/nyquist/ ... l#index350
Code: Select all
;; 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: http://www.cs.cmu.edu/~dst/LispBook/index.html
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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Senior Forum Staff
 
Posts: 43465
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux Debian


Return to Nyquist



Who is online

Users browsing this forum: No registered users and 1 guest