A new, and long awaited enhancement for Nyquist plug-ins has recently been added to the Audacity 2.0.7 source code. Nyquist “process” type plug-ins may now have a Preview button.
This is “breaking news”, so may be subject to change.
Preview cannot be expected to work correctly for all effects, so it is left to the plug-in author to enable the Preview button when appropriate. This is done with a new header command:
;preview enabled
An alternative syntax is also available:
;preview true
In order for Preview to work reliably, it has been necessary to tighten up the definition of “process” type plug-ins.
As has always been the case, the “process” type plug-in should be used for plug-ins that process audio.
Up to and including Audacity 2.0.6 it has been possible (but poor practice imo) to define “analyze” type plug-ins as “process” type, and vice verse. With the addition of the Preview button, “process” and “analyze” type plug-ins are no longer the same, so the correct “type” should be set by the plug-in author.
Differences between plug-in types
As described on the wiki (http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference#Required_plug-in_header_lines) the “type” of a plug-in is set by one of:
- ;type generate
- ;type process
- ;type analyze
The broad definition of each type could be described:
- ;type generate
Plug-ins that generate audio. - ;type process
Plug-ins that process audio. - ;type analyze
Plug-ins that perform analysis.
A certain degree of abuse of these definitions has, and continues to be allowed, which is useful as some plug-ins fall outside of all of these descriptions.
Differences between “analyze” and “process” types in Audacity 2.0.7 alpha
- Process type plug-ins may have a Preview button. Analyze plug-ins would not normally have a Preview button.
- Analyze plug-ins may return text or numeric output for each selected track. If a process type plug-in returns non-audio data, the plug-in ends execution. This means that a process type plug-in returning text or numeric output can return once only (useful if displaying a help screen, and usually desirable when displaying error messages).
- Analyze type plug-ins can return labels, process type plug-ins cannot.
When to use / not use a Preview button
The Preview button should only be used in cases where the preview will reliably match the result of processing the selection.
Due to a limitation in Audacity’s “preview” feature, effects that change over the duration of the processed selection will usually not preview correctly.
The Nyquist Prompt effect always has a preview button. This allows code to be tested to see if it is appropriate to use a preview button.
An example of an effect that would preview incorrectly is the “Adjustable Fade” effect.
When applied with the OK or Debug button, the fade will be applied to the entire selection.
When previewed, the fade would occur over the duration of the preview.
Obviously, if the selection was 2 minutes long and the preview 3 seconds, a 2 minute fade will sound completely different from a 3 second fade, so it is not appropriate to include a preview button in this effect.
It will probably be possible to work around this limitation in later versions of Audacity, but currently not.
The new preview button should be available in nightly builds for Windows / Mac OS X from 8th October 2014, and for all platforms if building from the current SVN development code.
This information will be added to the wiki in due course.