Hi, everyone. So I just joined this site for some help in learning Nyquist. My Computer Science class requires that we pick up a new programming language that we’ve never seen before and write a program with it and make a presentation on the program as well as the language. Since I’ve had fun messing around with Audacity in the past, I decided to ask my Professor if I could do Nyquist. I’ve already done a certain amount of research on my own, so I’m left with a few specific questions.
First of all, is there any program that might help me auto-format Nyquist plugins (I’m assuming it would probably not be Nyquist specific, it would more likely be used for lisp). For example Codeblocks has a feature that will auto-indent C++ and C programs. I’m having trouble reading a lot of code from plugins, because most of the plugins I’ve tried to take a look at try to fit as much of the code on to one line as possible, to the point where it’s hard to tell which parts are comments and which parts are code.
Secondly I’m having trouble using envelope features. I’ve tried running examples from the Nyquist 2.37 Manual, and I can’t get it right:
(defun mkwave ()
(setf *table* (sim (scale 0.5 (build-harmonic 1.0 2048))
(scale 0.25 (build-harmonic 2.0 2048))
(scale 0.125 (build-harmonic 3.0 2048))
(scale 0.062 (build-harmonic 4.0 2048))))
(setf *table* (list *table* (hz-to-step 1) T)))
(cond ((not (boundp ’*mkwave*))
(mkwave)
(setf *mkwave* t)))
First I tried running this in audacity’s “Nyquist Prompt…” effect. No luck. I just got a “Nyquist did not return audio” message. Then I tried pasting it into a plugin mkwave.ny which I placed in my plugins folder…Audacity can’t even find it apparently:
;nyquist plug-in
;version 3
;type process
;name "Mkwave..."
;action "How do envelopes work?"
;info "example program to play around with, to try to understand envelopes..."
(defun mkwave ()
(setf *table* (sim (scale 0.5 (build-harmonic 1.0 2048))
(scale 0.25 (build-harmonic 2.0 2048))
(scale 0.125 (build-harmonic 3.0 2048))
(scale 0.062 (build-harmonic 4.0 2048))))
(setf *table* (list *table* (hz-to-step 1) T)))
(cond ((not (boundp ’*mkwave*))
(mkwave)
(setf *mkwave* t)))
I’m also having the same kind of difficulty producing notes from the manual’s example code.
I did have some luck using the prebuilt sine-table, saw-table, and tri-table functions, though I’d like to know a little bit more. I tried the following code in Nyquist Prompt:
(vector
(mult (aref s 1) (osc (hz-to-step 3) 1.0 *sine-table* 90))
(mult (aref s 0) (osc (hz-to-step 3) 1.0 *sine-table* 0)))
It worked pretty much as expected, but my understanding is slightly lower than what I’d like it to be.
Take the left channel and give it an oscillation [???] … make oscillation the shape of sine curve, with a starting phase of 90 degrees.
Do the same for the right channel, but this time the sine wave starts off at 0 degrees.
Increasing the number after hz-to-step seems to make the period shorter (resulting in quicker and choppier increase/decrease in amplitude).
Something along those lines?
I can’t seem to figure out though what the 1.0 part is doing (before the sine table and after the (hz-to-step), I just took that from other example codes, to see what was going on. The only thing that I can seem to determine is that the number cannot be less than or equal to zero, or else the code will not work at all. Other than that I can’t really see much of a difference. My guess is that it has something to do with how much the amplitude is increased/decreased rather than how often, but I can’t tell for sure.
I also wanted to look at the code for the “phaser…” plug-in because that appears to be doing something entirely different than this. (When viewing in spectrum form I’ve noticed you can actually see a sine-wave cut out of the stereo tracks.) I can’t seem to find the phaser plugin in my plugin directory. I’m assuming there might be a good reason for this.
I think that’s more or less the bulk of it for now. Later I might want to know about dealing with frequencies. I’d kind of like to write an auto bass-boost/treble-cut this user selected channel and treble-boost/base cut the other channel. I think I have some idea on how to select channel 1 or channel 0 via controls. This would be in a similar manner to what you can do with the Equalization plugin and it’s built in curves, but it would perform four steps at once, instead of one. So if anyone can point me towards a frequency tutorial, that’d be great.
Any and all help is greatly appreciated (especially any help with envelopes).