Ooh, that’s interesting. I presume that you mean this: VamPy: Vamp Plugins in Python
I wasn’t aware of that - I’ll have to take a look (when I find time… sigh), then we can share notes ![]()
It’s a lovely language once you get used to all of the parentheses (though not as beautiful as Python
)
Essential ingredients for Nyquist (LISP) programming:
A text editor that does parentheses matching (preferably one that has some form of LISP syntax highlighting). On Linux I use Scite, and on Windows Notepad++. LISP Syntax highlighting for Nyquist is not 100%, but it is close enough to be useful.
Careful indentation (you should be used to this from using Python). Although LISP does not “require” indentation in the way that Python does, it makes the code MUCH more readable. You should not be relying on counting parentheses to read the code.
Here’s an example from a plug-in that I wrote recently:
(defun stereo-rms(ar)
;;; Stereo RMS is the root mean of all (samples ^ 2) [both channels]
(let ((left-mean-sq (* (aref ar 0)(aref ar 0)))
(right-mean-sq (* (aref ar 1)(aref ar 1))))
(sqrt (/ (+ left-mean-sq right-mean-sq) 2.0))))
You should be able to see (even without knowing LISP syntax) that:
- This defines a function called “stereo-rms”
- The function takes one argument called “ar” (the name could be more descriptive, but this is my shorthand for an array variable)
- Nyquist is normally written in lower case (Nyquist is NOT case sensitive, but case is preserved in quoted string literals)
- Semicolons (any number) are used for comments
- The LET form in this example has two assignments: “left-mean-sq” and “right-mean-sq”.
- The function returns the result of (sqrt (/ (+ left-mean-sq right-mean-sq) 2.0))
The other thing that you will probably notice is the “s-expressions” (symbolic expression). In this kind of notation, functions are called as:
(function-name arguments)
so rather than writing (x + y + z), where the function is “+”, in LISP it is written (+ x y z), and no commas!
The example code above “could” have been written as:
(defun stereo-rms(ar)
(let ((left-mean-sq (* (aref ar 0)(aref ar 0)))
(right-mean-sq (* (aref ar 1)(aref ar 1))))
(sqrt (/ (+ left-mean-sq right-mean-sq) 2.0))))
or (even worse) as
(defun stereo-rms(ar) (let ((left-mean-sq (* (aref ar 0)(aref ar 0))) (right-mean-sq (* (aref ar 1)(aref ar 1)))) (sqrt (/ (+ left-mean-sq right-mean-sq) 2.0))))
but I hope you agree that the first form is much more readable.
I would highly recommend taking a glance at the links in this post: Manuals and reference material
Any questions regarding Nyquist may be posted in this forum board: Nyquist - Audacity Forum