Limits of what I can do

Hi, I thought I might learn some Nyquist by doing, adapting some of the packaged routines. Some newbie questions about the limitations.

So it looks like filters can rewrite the selection, and are applied repeatedly and independently to different tracks if they are selected simultaneously. Correct?

Analysis functions return lists of data that specify new labels. It is also possible to give the user information via info dialogs.

Are there further possibilities for inspecting and changing the state of the project or conveying info to the user?

Specifically: is there any way I can read parts of the track before and after the selected range? And, is there a way I can adjust the boundaries of the selected range, as is done by the builtin find-zero-crossings command (bound to the Z key)? I could write an analyzer that makes one label, then pick the label, but I want to know if I can even avoid that pick.


There is a good introduction to Nyquist plug-ins here:

There are three “types” of plug-ins:
“process” (effects)

When a plug-in is run, it returns a “value” that is usually either a sound, an “array of sounds” (a stereo sound), text, or labels.
Nyquist plug-ins can also read and write files, though specifying the path and file name is a bit of a pain, especially if you want it to work on Mac, Windows and Linux.

Usually “generate” and “process” effects return sounds (or stereo sounds).
“Analyze” plug-ins usually return labels or text.

Nyquist is primarily designed for handling audio and music. It can be used for other things (such as text and numerical data), but handling audio is what it is best at.

Nyquist plug-ins are generally applied to one track at a time. If you select multiple tracks, Nyquist will process each selected track in turn.
There is a limited capability to pass data from one track to another by attaching it to the persistent global variable ^SCRATCH^. Other than SCRATCH variables are deleted as soon as the track has been processed.

For “analyze” and “process” type plug-ins, Nyquist has access to the selected audio data via the variable “S”.
Nyquist also has access to the length (in samples) of the selection through the variable “LEN”, and the sample rate of the track through the variable "SOUND_SRATE*.

No. Nyquist can only access the selection.

Not really. If Nyquist returns a sound, then that replaces the previous selection and becomes the new selection. The new selection will be the same size as the returned audio, which may bigger, smaller, or the same size as the original selection.

Nyquist can only return a stereo sound if a stereo track is selected.