Removing Envelope Control Points

[Moderator note: Topic split from here: https://forum.audacityteam.org/t/envelope-tool-set-points/25926/4 ]

Steve,
That’s worth having as an extra Effect: Reset Envelope, isn’t it?

I wouldn’t expect there to be much demand for such an “effect” as control points are normally only present if the user has deliberately put them there.

Another method is to use the Equalizer effect with the controls set to “flat”.
Neither of these methods are intended to work, they only work because these effects do not currently support envelope control points, so after the audio is “processed” it is returned to the track without the control points.

With each soundtrack that I produce for my AVs I usually have at least one occasion when, after a complex set of enveloping I think: that’s a load of rubbish, let’s reset those tracks and start again. For me, at present, that means delete the tracks and re-import them. Select the tracks and apply an effect would be so much simpler. So…

If I take your code example, and key it into a file with Notepad, and save that file as “ResetEnv.ny”; then proceed to move that file to the proper folder in Audacity, would that give me the effect in Audacity? Or does the Nyquist code have to have some kind of formatted header lines in it to be acceptable as an installed effect?

Nyquist plug-ins require some header text. You will find full details on this page: http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference
This will be the smallest Nyquist plug-in ever :smiley:

I’ll split this post and move it to the Nyquist section.

Topic split.

In your proposed plug-in, the only bit of Nyquist code (in addition to the header) is:

s

“S” is a special global variable that Audacity uses to pass the sound from the audio track to Nyquist.
Putting this as the only code line in the plug-in tells Audacity to put the sound back (unaltered) into the track.

The reason that the parentheses are required for the Nyquist Prompt version, is because Nyquist may be written in one of two types of syntax; either LISP syntax or SAL syntax. Most of the current Audacity plug-ins are written in LISP syntax, but the Nyquist Prompt supports both. If the parentheses are missed out, then the Nyquist Prompt gets confused because “S” on its own does not look like LISP. The parentheses are used there just to make it clear to the Nyquist Prompt effect that it is LISP syntax and not SAL.

OK, thanks, Steve. I’ll give that a whirl tomorrow!

Steve,

100% success! :slight_smile:

Here’s the code for the effect, if anyone else is interested in it.

;nyquist plug-in
;version 3
;type process
;name "Reset Envelope"
;action "Resetting..."
s

Does that make me a fully qualified Nyquist programmer? :smiley:

Terrific, congratulations :smiley:
PGA => :ugeek:


To nit-pick a couple of minor details:

  • The plug-in is actually a “version 1” plug-in as it does not have the control features of version 2 or version 3 plug-ins and it should work in Audacity 1.2.x
  • If the plug-in were intended for general release, it is preferred that license information is included as commented text (though I don’t think that’s really necessary in this case :slight_smile:

Neither of these “issues” affect the functioning of the plug-in.

It’s a good start :wink:

Just to reiterate though, it is an accident that this works and not a design feature, so it could easily change in later Audacity versions.

Hello,

I apologize up front. I was searching for a way to reset envelope points and I ran across the code in this thread… I am hoping to use it, but am a bit bewildered by the notes about various Audacity versions and Nyquist in general when I search.

How does one install this? I am using Audacity 2.1.0 on Mac OS X El Cap. I attempted to run this code in Nyquist prompt.

;nyquist plug-in
;version 3
;type process
;name "Reset Envelope"
;action "Resetting..."
s

The error:

… actually, I just noticed that after re-scanning the plug-ins, Nyquist prompt is no longer under Effects. Should I bother to get that back?

I also tried to add this code in a .ny file under Plug-Ins. It doesn’t appear.

I can re-import the track and re-massage it. It won’t have my envelope points at that point, but it’s extra work I wouldn’t mind avoiding.

Any help is appreciated.

m

What was the error message?

The error is “no return statement”. It does work in current Audacity if you replace “s” with

return s

You can always Edit > Undo envelope points while the project is open.

Although it is hard work, you can also drag envelope points out of the track to remove them.


Gale

OK I see that.
The problem is that Audacity is incorrectly guessing that the code is using SAL syntax rather than LISP syntax because there are no parentheses in the code.
There are two correct solutions.

One is as Gale wrote:

return s

which is the same function using SAL syntax.

The other is to add “codetype lisp”, which explicitly tells Audacity to interpret the code as LISP syntax.

;nyquist plug-in
;version 3
;type process
;codetype lisp
;name "Reset Envelope"
;action "Resetting..."
s

The code could also be written as a “version 4” plug-in, which would then use the variable track rather than S

;nyquist plug-in
;version 4
;type process
;codetype lisp
;name "Reset Envelope"
;action "Resetting..."
*track*

Documentation about this is here: Missing features - Audacity Support

Just to add the original snippet.
This time for the Nyquist prompt (which should really be re-enabled imo) and with the legacy check box disabled:

()*track*

The advantage, you can save it as an user preset (under “Manage”) without populating the effect menu further and it is very concise…

I’m not sure what you mean Robert. By default the Nyquist Prompt is enabled and the legacy checkbox is not selected.

Being a bit pedantic, yes this works:

()*track*

but it is perhaps a bit of a hack. The empty parentheses are not really valid code, but they are harmless, and they persuade the code parser in Audacity that the code is using LISP syntax. As Nyquist is a third party library we can’t guarantee that the empty parentheses will always be ignored by Nyquist rather than throwing an error (even though it does not throw an error now). So “technically” I think it “more correct” to explicitly tell Audacity that you are using LISP syntax by using the command “;codetype”. Similarly we could remove the “legacy syntax” checkbox because the “;version” command explicitly tells Audacity which version is being used. The reason that the legacy syntax checkbox was added was not because it is “required”, but as a matter of convenience when running old code snippets.

Thus in the Nyquist Prompt we can use:

;version 3
;codetype lisp
s

or,

;codetype lisp
;version 4
*track*

and in both cases it does not matter if the “legacy syntax” checkbox is checked or not because the “;version” command overrides the checkbox.

The user said that the Nyquist prompt wasn’t in his effect list and if he should try to re-install it, thus my comment.
A more syntax-friendly code version is:

;version 4
(cue *track*

Yes, that’s a bit worrying. The Nyquist Prompt is enabled by default, so should automatically be present in the Effect menu.
As they are on OS X, an explanation could be that they have not installed Audacity correctly. That’s why I was asking about error messages and hoping that they would provide more information (See: FAQ:Errors - Audacity Manual)