Nyquist contains a function “ENV” (envelope) that is a special form of the pwl (piece-wise linear envelope) which is very useful when synthesizing sounds.
There is a good description of the Envelope function and how to use it in the Nyquist manual. It works in a similar manner to the traditional ADSR envelope that is common in many synthesizers.
Unfortunately there is currently a bug in the Nyquist code that means that the envelope function does not always work correctly. Here is the technical description of the problem (taken from Audacity’s bug tracking web page)
In the Nyquist function envt1, t2, t4, l1, l2, l3, [dur] if t1 + t2 + 2ms + t4 is greater than the envelope duration, then a two-phase envelope is substituted that has an attack/release time ratio of t1/t4. However, if t1 and t4 are integers then the attack time becomes zero and the release time becomes the duration, which is not what should happen.
If you want to check if your version of Audacity has this bug:
Select less than 3.002 seconds of a track and from the Nyquist Prompt run the code:
1 2 3 |
(let ((t1 1.0)(t2 1)(t4 1)(l1 1)(l2 0.5)(l3 0.5)) (mult (osc 60)(env t1 t2 t4 l1 l2 l3))) |
The correct envelope is produced with an attack/release ratio of 1:1
Now change the code so that both t1 and t4 are integers:
1 2 3 |
(let ((t1 1)(t2 1)(t4 1)(l1 1)(l2 0.5)(l3 0.5)) (mult (osc 60)(env t1 t2 t4 l1 l2 l3))) |
The envelope is incorrect as in the bug description.
Fortunately there is a fairly easy fix.
Look in your Audacity program folder and in the sub-folder “nyquist” find the file nyquist.lsp. Around about line 1046 there is a line:
1 2 |
(setf ratio (/ t1 (+ t1 t4))) |
Change that line to:
1 2 |
(setf ratio (/ t1 (float (+ t1 t4))))setf ratio (/ t1 (float (+ t1 t4)))) |
As you can probably work out from the surrounding code in the nyquist.lsp file, the problem exists because if t1 and t4 are integers, then (/ t1 (+ t1 t4)) will always be zero.