Text Envelope

I was thinking more if string widgets didn’t bypass comma > dot translation for appropriate locales, rather than the plug-in author has to code it in or the user has to figure it out. So many users in Audacity these days are inexperienced with computers you can’t assume they will realise that programs may not respect non-dot decimal separators, especially given they are respected in slider widgets.

I don’t know if Widgets or Audacity bypasses the translation, but if it existed for de, fr and other appropriate locales, would it prevent you using comma list separators in UK/USA locales? I just feel the inconsistency in European locales where comma can be decimal separator in one text box and not another is much worse than the problem of a user not realising that the decimal and list separators must be different. I assume most users would automatically have the separators different purely so that they are easily distinguished.

For myself I wouldn’t mind list separators being restricted to something reasonable on the row above spacebar e.g. “space” or “/” or “” .


Gale

String input does not and should not have comma > dot translations. If that were not the case it could create havoc with punctuation.

That is exactly why I initially spelt out the requirement to use a dot as the decimal separator (in both the main GUI and the Help screen if I remember correctly).

Not in 1.3.12 or 1.3.13 - it’s broken.

OK, yes I see the point that you are making. Even if it’s currently broken for Nyquist plug-ins, other effects use decimal commas for appropriate locales and I should assume that it will eventually be fixed for Nyquist slider widgets.

On the other hand the reverse is also true - for English and many non-European locales it is the norm to use comma separated variables and it is inconsistent that commas are functionally identical to dots.

If I recall correctly, Edgar suggested that to not do so would require “a really stupid user” :wink:

Off-hand I’m not sure that slashes will behave properly because of their use as escape characters - I’ll have to test that. Colons, semi-colons and all types of brackets are OK.

Personally I’d still like to be able to use commas, so on reflection it might be better that I make the default that decimal separators may be commas or dots, but provide a switch within the code to disable decimal commas (for those like myself that prefer that).

Steve is correct is worrying about the character as a separator. It is always treated by the string widget as the escape character and if the following letter is not an escapable one, the dissappears. This makes it nasty for windows users to enter a path name in a text box. I haven’t been able to find any workaround to ignore the escape character when using string inputs in plug-ins. You can always use \ where you really want a , but this is awkward and doesn’t look so good.

Dave

I was only of course suggesting string widget comma > dot translation in locales where the decimal separator is the comma. If there was nothing more complex than a box with value pairs to consider that would be consistent for the locale (as an uneducated user would see it). But if that means Germans who understand “separators for variables should be commas” are forced to use something else in complex expressions, that’s bad too (but to me, less so).

A lot depends on an assessment of the language problem. You could argue a German might just be able to figure out from the GUI that value pairs were needed but due to the language difference, not understand what was said about having to use dot for decimal separator. OTOH you could argue it’s a waste of time discussing because the plug-ins are inaccessible to people who can’t speak English anyway. I’m not convinced setting up a translation mechanism for Nyquist plug-ins needs to be impossible.

That sounds reasonable, but I think there should be a second choice of value separator given comma can’t then be used. I don’t care for brackets much (square ones are more physically comfortable though). Do pipes “|” have any issues?


Gale

According to Wikipedia, the common way to write lists in Germany are to use a decimal comma and a colon as the variable separator.

Only that they are Shift characters (which is not very convenient) and revert to a backslash if the shift key is not down (which will probably break things).

I could have a long list of characters to try and suit every taste, but it needs to be documented in very little space, so I think I’ll go for just “space”, “colon” and “brackets” and apply a broad definition to include
space : ; < > [ ] { } ( )

If anyone particularly wants to use a comma, then there will be a simple edit they can make to the Nyquist code.

After much discussion, this is hopefully close to the final version (though some improvements can probably be made to the Help screens - please post your suggestions).

I have attempted to bring together the best features and compromises from all previous versions, and the code has been almost completely rewritten.

Main features in this version:

  • Decimal values must use a dot as the decimal separator. This is in keeping with the current behaviour of all other Nyquist plug-ins.
  • Recommended version of Audacity: 1.3.14 (or later) *1
  • Minimum version of Audacity: 1.3.8
  • Control Point amplification settings may be entered as dB or percentage.
  • Control Point time settings may be entered as milliseconds, seconds, minutes or as a percentage of the selection.
  • Control Point time positions can be specified as distance from the start and/or the end of the selection - positive values are the time after the starting point of the selection. negative values are the time before the end of the selection.
  • Almost any characters can be used as delimiters between control point values.*2
  • Comprehensive error checking of user input.
  • Extensive error reporting of invalid user input *3
  • Help screens and examples included *4
  • GPL v2.

*1) Due to limitations in Audacity Nyquist prior to version 1.3.14, several non-numerical characters will cause errors in this plug-in that cannot be captured by the Nyquist code. For Audacity versions between 1.3.8 and 1.3.13 inclusive, it is recommended to enter values for the Intermediate Control Points (if used) as pairs of numbers separated by spaces, brackets or colons.


*2) For Audacity 1.3.14 (and later), text handling has been much improved in Nyquist plug-ins and almost any characters may be used. For example, and Intermediate Control Point pair could be entered in any of the following ways:

10,-6
10    -6
(10 : -6)
/10 &  -6/
10 seconds -6 dB

*3) Some errors caused by invalid user input cannot be captured by the code in Audacity versions less than 1.3.14

*4) The following Help and Example screens are available:

HELP (overview):

This plug-in simulates the behaviour or the Envelope tool
using text input rather than mouse / pointer control.

‘Select Function’ allows applying the effect or viewing a
help menu.

Time units may be in milliseconds, seconds, minutes or as a
percentage of the selection (default = seconds).
Amplification units may be in dB or as % (default = dB).

The initial and final amplification levels for the selection
have their own controls, allowing easy linear fading from one
level to another.

Intermediate Control Points are entered as Time/Value pairs.
Example: 2.5,-6 : 5.0,-12 : 10,-48

If Units are seconds and dB, the example above would mean:
at 2.5 seconds, amplify by -6 dB
at 5 seconds, amplify by -12 dB
at 10 seconds, amplify by -48 dB.

Values can be separated by spaces or other non-number character
such as comma, colon or bracket.

Non-numerical text is stripped from the input.



EXAMPLES:

For a linear fade out, set:
Initial Amplification = 100 (%)
Final Amplification = 0 (%)
and no Intermediate Control Points.

For a smooth fade to half volume, try setting:
Time Units = %
Initial Amplification = 100 (%)
Final Amplification = 50 (%)
17 97 : 33 88 : 50 75 : 68 63 : 83 53

or for the same effect using a dB scale:
Time Units = %
Initial Amplification = 0 (dB)
Final Amplification = -6 (dB)
Intermediate Control Points:
17 -0.3 : 33 -1.1 : 50 -2.5 : 68 -4 : 83 -5.4



TIPS:

100% amplification is equivalent to 0 dB amplification.
50% amplification is equivalent to -6 dB amplification.
25% amplification is equivalent to -12 dB amplification.
0% amplification is equivalent to -inf dB amplification.

Positive time values are from the start of the selection.
Negative time values are from the end of the selection.

Example, to set 50% amplification 1 second after the start
and 50% amplification 1 second before the end of the selection
you could set control points to:
1 50 : -1 50

Time/value pairs are automatically sorted into time order, so
to add an extra time value pair it may be added to the end of
the Control Point list.
‘1 50 : 2 20’ has the same effect as ‘2 20 : 1 50’.

It is often easiest to first apply the effect with only the
initial and final settings. Use Ctrl+Z to undo and reapply
the effect with additional Intermediate Control Point pairs
as required.

[UPDATE:] Click at end of selection when processing part of an audio track is now fixed.
TextEnvelope.ny (10.2 KB)

Thanks, Steve. I added some suggestions to the help text (in red) below.

According to conventions we should have no more than 25 lines of help text or 50 characters per line. The first screen has too many lines - perhaps an answer would be to cut therefrom

If Units are seconds and dB, the example above would mean:
at 2.5 seconds, amplify by -6 dB
at 5 seconds, amplify by -12 dB
at 10 seconds, amplify by -48 dB.

I have not fixed all the lines that are over 50 characters.

I think space permitting it would be helpful to have one or two examples of positive % amplification equivalents e.g. 150% or 200%.

The code comment “;;To avoid problems with these versions use only numbers and spaces” could possibly say “;; To avoid problems with these versions use only numbers and spaces in Intermediate Control Points”.

Actually I’m not sure what the changes in 1.3.14 are that have affected this plug-in. I had not picked this up for possible release noting. Can you point me to it possibly?
http://code.google.com/p/audacity/source/list


Gale

HELP (overview):

This plug-in simulates the behaviour > of > the Envelope tool
using text input rather than mouse / pointer control.

‘Select Function’ allows applying the effect or viewing a
help menu.

Time units may be in milliseconds, seconds, minutes or as a
percentage of the selection (default = seconds).
Amplification units may be in dB or as % (default = dB).

The initial and final amplification levels for the selection
have their own controls, allowing easy linear fading from one
level to another.

Intermediate Control Points are entered as Time/Value pairs.
Example: 2.5,-6 : 5.0,-12 : 10,-48

If Units are seconds and dB, the example above would mean:
at 2.5 seconds, amplify by -6 dB
at 5 seconds, amplify by -12 dB
at 10 seconds, amplify by -48 dB.

Values can be separated by spaces or other > non-numeric
characters such as comma, colon or bracket.

Non-> numeric > text is stripped from the input.



EXAMPLES:

For a linear fade out, set:
Initial Amplification = 100 (%)
Final Amplification = 0 (%)
and no Intermediate Control Points.

For a smooth fade to half volume, try setting:
Time Units = %
Initial Amplification = 100 (%)
Final Amplification = 50 (%)
17 97 : 33 88 : 50 75 : 68 63 : 83 53

or for the same effect using a dB scale:
Time Units = %
Initial Amplification = 0 (dB)
Final Amplification = -6 (dB)
Intermediate Control Points:
17 -0.3 : 33 -1.1 : 50 -2.5 : 68 -4 : 83 -5.4



TIPS:

100% amplification amplifies by 0 dB.
50% amplification amplifies by -6 dB.
25% amplification amplifies by -12 dB.
0% (or empty) amplification results in silence.

Positive time values are from the start of the selection.
Negative time values are from the end of the selection.


Example, to set 50% amplification 1 second after
the start and 50% amplification 1 second before
the end of the selection:
1 50 : -1 50


Time/value pairs are always applied in time order
so an extra time value pair can simply be added
to the end of the Control Point list.
‘1 50 : 2 20’ has the same effect as ‘2 20 : 1 50’.

It is often easiest to first apply the effect with only the
initial and final settings. Use > CTRL > + Z to undo and reapply
the effect with additional Intermediate Control Point pairs
as required.

Thanks for the comments Gale, I was rather hoping that you might make some suggestions about the text.

The changes were by Edgar-rft, and were discussed on the forum here: https://forum.audacityteam.org/t/backslashes-and-double-quotes-in-text-input-widgets/16436/1
Here’s a Google code entry:
http://code.google.com/p/audacity/source/detail?r=10757

Looking at the dates, the changes should be in 1.3.13 - I’ve not got a copy installed on this box so I’ll check that tomorrow.

I’ve tested this with Audacity 1.3.13 beta Unicode (release version) on Windows XP, and some characters are not supported correctly.
In particular, and error is produced if you enter 13 as a Intermediate Control Point pair.

Looking at the source code for Audacity 1.3.13, there should not be an error as far as I can see, but there is.
I wonder if the Windows release was built with an old version of Nyquist.cpp.

You may remember there was a similar issue in March (shortly before the release of 1.3.13) of the Windows nightly being built with an old version of sal.lsp and sal-parse.lsp
http://audacity.238276.n2.nabble.com/Wrong-version-of-SAL-in-Windows-Nightly-td6173559.html#a6178609 . Could a similar thing have happened with Nyquist.cpp in the 1.3.13 Windows release?

Having done some more testing of this latest Text Envelope, the error checking appears to be pretty robust, even on versions before 1.3.14.
The only problems that I’ve found so far are that a backslash cannot be used as a value separator. (fairly obviously, numbers and dots can’t be used as value separators either, but these will produce sensible error messages).
I could perhaps change the caution regarding characters to “back-slashes must not be entered if using Audacity versions earlier than 1.3.14”.

Update:
I’ve tested this again on a different XP machine with Audacity 1.3.13 and it works.
I think there must be an old version of Nyquist.cpp on my original test machine.

I’ll update the plug-in text to say “Requires Audacity 1.3.13”.

Help screens now updated:

HELP (overview):
Text Envelope simulates the behavior of the
Envelope tool using only text input.

‘Select Function’ allows applying the effect or
viewing a help menu.

Time units may be milliseconds, seconds, minutes
or a % of the selection (default = seconds).

Amplification units may be dB or a % of the
selection (default = dB).

Initial and final amplification levels of the
selection have their own controls (default = 0),
allowing easy fading from one level to another.

Intermediate Control Points are entered as
Time/Value pairs.
Example: 2.5,-6 : 5.0,-12 : 10,-48

Values should be separated by non-numeric
characters such as space, comma, colon or bracket.

Non-numeric text is stripped from the input.



EXAMPLES:
For a linear fade out, set:
Initial Amplification = 100 (%)
Final Amplification = 0 (%)
and no Intermediate Control Points.

For a smooth fade to half volume, try setting:
Time Units = %
Initial Amplification = 100 (%)
Final Amplification = 50 (%)
17 97 : 33 88 : 50 75 : 68 63 : 83 53

or for the same effect using a dB scale:
Initial Amplification = 0 (dB)
Final Amplification = -6 (dB)
Intermediate Control Points:
17 -0.3 : 33 -1.1 : 50 -2.5 : 68 -4 : 83 -5.4

To swell the volume from the oiginal level to
double the original amplitude:
Time and Amplification units = %
Initial Amplification = 100
Final Amplification = 200
Intermediate Control Points:
20 110 : 40 130 : 60 170 : 80 190



TIPS:
100% amplification amplifies by 0 dB.
50% amplification amplifies by -6 dB.
25% amplification amplifies by -12 dB.
0% amplification results in silence.

Any non-number can separate pairs of values.
Example: “3 seconds, -6dB” or just “3 -6”

Positive times are from the start of the selection.
Negative times are from the end of the selection.
Example; to set 50% amplification 1 second after
the start and 50% amplification 1 second before
the end of the selection:
1 50 : -1 50

Time/value pairs are always applied in time order
so an extra time value pair can simply be added
to the end of the Control Point list.
‘1 50 : 2 20’ has the same effect as ‘2 20 : 1 50’.

It is often easiest to first apply the effect with
only the initial and final settings. Use CTRL+Z to
undo and reapply the effect with additional
Intermediate Control Point pairs as required.
TextEnvelope.ny (10.1 KB)

Thanks, Steve - looks good though I’ve only cursorily tested it (in 1.3.13 Unicode Release on XP and 7). Backslashes do not create errors there so as you have surmised you must have an old nyquist file somewhere.

To swell the volume from the o> r> iginal level to
double the original amplitude:
Time and Amplification units = %
Initial Amplification = 100
Final Amplification = 200
Intermediate Control Points:
20 110 : 40 130 : 60 170 : 80 190"

There is a minor typo in red, also since the control points are not necessary to double the amplitude in that example, should you say what the fade shape is or what the control points achieve?

Also I wondered if someone enters a time value control point in excess of the selection, should the plug-in throw an error rather than ignore the pair?


Gale

Doh! (and the number of times that I’ve read through it).

I thought I’d done that with the adjective “swell”.
I’ve run out of room on that help screen to add more description (unless you can think of some clever wording).
If it’s unclear as it is, I could use a more simple example with no intermediate pairs.

No, that’s a design decision, though I realise that I’ve missed out a feature from a previous version.
The user case for not throwing an error is if the user wishes to apply the same envelope to a another track and that track is shorter than the first track. In this case the same envelope shape should be applied so that the envelope rises and falls in sync with the first track (without throwing an error if there are control points beyond the end of the selection).

The feature that I forgot is regarding the handling of the initial and final points.
If the initial point is left empty, then the default amplification should be “no change” (0 dB or 100%).
If the final point is empty, then it should default to “no change” if there are no control points beyond the end of the selection, but if there are control point pairs beyond the end of the selection then an empty “Final Amplification” should have no effect.

I think this will produce the most intuitive behaviour - that is, if there is no Initial Amplification or Final Amplification set, then these controls are effectively ignored.

I’ll add this behaviour and change the first help screen to:

HELP (overview):
Text Envelope simulates the behavior of the
Envelope tool using only text input.

‘Select Function’ allows applying the effect or
viewing a help menu.

Time units may be milliseconds, seconds, minutes
or a % of the selection (default = seconds).

Amplification units may be dB or a % of the
selection (default = dB).

Initial and final amplification levels of the
selection have their own controls (default = 0),
allowing easy fading from one level to another.
If no value is set they are ignored.

Intermediate Control Points are entered as
Time/Value pairs.
Example: 2.5,-6 : 5.0,-12 : 10,-48

Values should be separated by non-numeric
characters such as space, comma, colon or bracket.
Non-numeric text is stripped from the input.

I’ve changed the Examples screen to make it more clear what the Intermediate Control Points do:

"EXAMPLES:
For a linear fade out, set:
Initial Amplification = 100 (%)
Final Amplification = 0 (%)
and no Intermediate Control Points.

For a smooth fade to half volume, try setting:
Time Units = %
Initial Amplification = 100 (%)
Final Amplification = 50 (%)
17 97 : 33 88 : 50 75 : 68 63 : 83 53

or for the same effect using a dB scale:
Initial Amplification = 0 (dB)
Final Amplification = -6 (dB)
Intermediate Control Points:
17 -0.3 : 33 -1.1 : 50 -2.5 : 68 -4 : 83 -5.4

To swell the volume > smoothly > from the original
level to double the original amplitude:
Time and Amplification units = %
Initial Amplification = 100
Final Amplification = 200
Intermediate Control Points:
20 110 : 40 130 : 60 170 : 80 190

I thought that might be the reason. I think there are use cases where an error message would be useful (the user knocks time units control to something unintended or forgets to change it), but on balance I think your decision is perfectly reasonable.

I agree, I was a bit concerned about empty “Initial” or “Final” % amplification producing silence, which was why I suggested adding (“or empty”) to the relevant example. Anyway I think it’s better as you suggest.

I assume there is no way with a future Nyquist enhancement that this plug-in could add its envelope points to the waveform so you could have the best of text and mouse input? Someone who tried your text envelope has already suggested that to me, but perhaps a better long-term approach would be text entry for the real Envelope Tool? I think that would work really well on right-click/context key. Perhaps it would be better implemented by adding envelope points at the cursor rather then the mouse pointer?

No other comments from me. It looks like it’s ready for the Wiki when you make your suggested changes. I think there is a moderately strong case for it being distributed in Audacity, but perhaps not until consolidation has been agreed about the multiple fade and pass effects we have now .



Gale

Nyquist support for envelope points is on the “wish list” https://forum.audacityteam.org/t/nyquist-wish-list/15530/1

"_Pass other track data
http://forum.audacityteam.org/viewtopic.php?f=39&t=34365&start=10#p127069

  • Track name
  • Track time
  • Channel allocation (for mono tracks)
  • RMS
  • Start time
  • Envelope Points
  • Bit depth"_

As we’ve not yet got that functionality we’re limited to scaling the audio data according to the envelope.

Here’s the new version with the changes applied.
TextEnvelope.ny (10.6 KB)
Handling text in Nyquist is rather complicated, so the more testing that this plug-in gets the better.
Please post any issues with this plug-in in this forum thread.

Hi Steve, I tried it briefly and it seems to be working fine…

I haven’t tried to put absurd values/syntaxes in the intermediate points… should I also check if it is dumb-proof?

Not quite how I would have put it, but yes please. I’ve tried to make this plug-in robust against user error.

This plug-in is now available on the Audacity wiki: http://wiki.audacityteam.org/wiki/Nyquist_Effect_Plug-ins#Text_Envelope