This plug-in produces “Equal Power” fades.
Square Root of linear, Cosine and Logarithmic.
In/out versions of each.
eq-power.ny (949 Bytes)
(Steve has meanwhile given a good summary of my view on the subject, you can skip the rest of this post altogether if you don’t want to read along my somewhat alluve statements)
I have not yet given any vote whatsoever. I wanted to show in my post above, which difficulties arise from the meddling of different fade styles, their modification and their application to transitions that do not go from silence to unity gain.
The fundamental source for the curve types is very limited, especially when we want to use them as crossfades.
Imagine an capital X, that’s how a crossfade looks in general when we put the two tracks one over the other.
The “Helvetic” X is the simplist case, all lines are linear.
An X in handwriting has more serifs and looks like DC (without the straight line and very close together). This figure is represented by the raised cosine. The third case would maybe look like a bowl on a tripod with swung legs. For this, we do not have a curve, because it sounds a little choppy at the start and end of the transition.
The intersection of the X’s legs is always 0.5 or - 6 dB, i.e. equal gain. This means that no samples that have the max amplitude (1 or -1) can add up to more than unity gain (1 or 0 dB).
uncorrelated tracks tend to eclipse one another, that’s why we want to amplify up to 3 dB (equal power) over unity gain (= 141 %) That’s what the mid-point boost slider is normally made for and ranges only from -6 dB to -3 dB (for individual tracks) or 0 to +3 dB (sum of the tracks).
The built-in fade effects represent the case of 0 dB, whereas the cross fades represent +3 dB. There’s no way to get intermediate amplifications without Steve’s slider in his plug-in, that is what it makes so unique and genius.
What me troubles a little bit is the fact that the slider has evolved from a pure loudness correction to a curve morphing tool. I see the reasons and the apparent necessity behind it due to the will to cover all imagineable cases.
Ok, so far we have those possibilities for presets:
- linear with mid-boost 0 % = built-in fade-in/-out.
- linear with mid-boost 50 % = original cross-fade with full equal power.
- S-curve with 0 % mid-boost = Steve’s pro fade-out without lowpass.
- S-curve with mid-boost 50 % = fine crossfade for unrelated tracks (since equal powered).
Those should be included as presets in order to cover the legacy (and musical cross fade) effects. For those I vote.
It is selfevident that these presets behave differently when applied as partial fades. The user has after all no other choice then to experiment with the plug-in to get very fancy results which they might want to achieve.
As I stated above, the remaining logarithmic and exponential fades do not apply to cross fades, unless they are applied to one leg of the X and its counterpart to the one diagonally vis-a-vis or across.
The mid-point boost/cut slider has now a entirely different meaning to it and is no more related to equal gain or power. In this case, it serves as a modifier for the curvature of the function, but for this task the range is not high enough (whereas the range was previously too high), at least if you want to get near a linear line again. I am sorry, that sounds horribly complicated and could best be expressed with images, but you know…
Let us have a look at a exponential increasing fade in to illustrate this:
(setf *float-format* "%.4f")
(dotimes (num 20)
(prin1 (linear-to-db (/ (exp (float num)) (exp 19.0))))
(if (eql (rem (1+ num) 5) 0) (format t " ~a~%" (1+ num)) (terpri)))
By pressing the debug button after inserting the code in the Nyq-prompt, you will get a list of the dB values for a mathematical correct exponential curve that is based on the eulerian number, i.e e^x with the necessary correction to have 0 dB at the end.
As you can see, the value in the middle of the transition is nearly silence (-86 dB).
If we would now set the mid-point slider to 50 %, the result would b -43 dB. We have to draw the square root 4 times to get near -6 dB at the middle point. However, this does only apply if we choose 20 values. For a exponential curve that goes over several seconds at a control sampling rate of 2205, the value in the middle will be so small that the mid-point slider had to range over thousands of percents to hear a difference.
That’s why it is important to put this basic function into a range that yields usable values.
In this environment it would be preferable to have a slider that moves the point, where the function has the value 0.5, on a vertical scale (Nyquist has the predefined function “exp-dec” which takes exact this value as an argument).
From my point of view, the adjustable fade has with the mid-point boost/cut not a control too much but one too few because the mid-point can’t be moved vertically.
What this slider would do concretely is that it morphes an logarithmic curve gradually into an exponential one (left to right, when used as fade-in).
It can of course also modify the linear and S-curve types to get interesting results.
By the way, you can change the term “exp” in the code above to “log” to see how a logarithmic fade-in looks like. it starts very steep and stays for a long time near unity gain. at the mid-point it has a value of -2 dB. It somewhat resembles a flame that the wind blows to one side.
The great challenge of this plug-in is that it is so mighty powerful hence the demand for presets which is perfectly understandable.
If I had had to design the plug-in (after reading this whole fading threads), those controls would most likely appear:
- “Presets” (with at the top, the legacy effects afterwards and usersaved ones at the end)
- “Basic function” - with Linear, S-curve, J-curve (that’s half an S-curve or a quarter of an cosine period), EXP/LOG and maybe others.
- “Left most gain” - with dB or % as text input.
- “Right most gain”
- “Mid-point Boost/Cut”
- “Mid-point Offset L/R” - as roughly explained above
- “Save as Preset” - a text box to enter a name for the current settings of the 5 preceding controls.
- “Plug-in settings” with “Save current as default”, “Reset to factory” and “Delete selected Preset”.
You see how much my views differ from others stated here that it is hard for me to give a definite vote for a plug-in that I will hardly ever use as it is.
Besides, the last two controls may appear to be unprogramable in Nyquist but they are not. The only thing that can’t be achieved by Nyquist is to show the actual values of an selected preset or to give a (graphical) feedback of the slider positions.
I am sorry that my posts get longer and longer each time and contribute (at first glance) so little to the problem at hand.
If I must be specific, I’d include all the presets mentioned until now and am not against any others because I love to try out presets.
OK. I think it’s easier to explain that way.
Maybe because you used the word “cosine” and then asked whether the slider-produced curves should be exact or only similar.
This is a software fade so it is easy for advanced users to analyse what it produces and ask questions.

As you can see from the screen shots, a “cosine” curve (or to be more precise, a 1/4 cycle cosine curve) is quite similar to a logarithmic curve.
Which is part of the problem (if it is one) - what’s the difference? If you don’t know the answer in the first place, it is not as easy to Google and find out as you might think.
So to repeat my question “Is +51 log or cosine?” (if we don’t change)?
Thanks for the plug-in with the Cross Fade aka Square Root, Cosine and Log fades. I only tried fade out on a 10 seconds tone, but I find a lot of difference between Cosine and Log after the mid point. Cosine sounds smoother. Log seems to maintain the loudness much further towards the end. Inverting one and playing both seems to confirm that. Between about 6s - 8s the playback continues to become louder, then stays at a steady loudness, rather than get quieter.
Which is the “better” of the two for the “preset” - log or cosine? The log possibly sounds too much like the square root, so cosine might be more interesting from that point of view. That might suggest going for “exact” curves rather than “similar” for the slider, which thus gives a log EQ Power at +50, yes?
Do I guess that you still prefer “similar”, because the exponential curves otherwise have too much near-silence? Is this the more serious problem than having two quite different EQ Power presets?
I care more about having separate logarithmic and EQ Power (log or cosine) presets - even if you still think such a logarithmic (non EQ) curve would only be educational (I can think of a few cases where it would suit quite well).
Gale
Thanks, Robert.
Obviously I struggle to follow in depth, but are you saying the current slider lacks sufficient range if applied to an existing fade? I am not sure about a practical case where the slider range is insufficient. I think two sliders for mid fade would be too much for a shipped effect… at least until “advanced” functionality can be hidden and unhidden in the GUI.
I am fine with adding one “S Curve” as a preset, making a potential total of six pairs of in/out. But I think six pairs ought to be enough.
Robert, your idea of users saving their own presets sounds interesting, but if it’s the case that the Nyquist sliders or text boxes cannot update to show the loaded preset, isn’t that a fundamental problem, especially for sighted users?
I guess though we should focus immediately on deciding which slider positive/negative behaviour we want, and which presets.
Gale
I don’t want to introduce a second slider at this stage of the plug-in development, although it could be kept in mind for a C+ adaption of the plug-in, where the result of the moved sliders can be previewed in the graphical output.
I imagine, it will then behave like setting up the graphical EQ.
When the mid-point slider’s range is increased, it would be possible to simulate true exponential and logarithmic functions from a linear base.
Maybe the problem is that the slider is relative and not absolute. We could set him up with a range from 0% to 100% and would thus determine the gain for the mid-point in an absolute manner.
for 0 to 1 fades, a value of 50% would mean equal gain and 70% equal power.
With a value of 99% you have a logarithmic like Fade-in, stands the slider at 1%, the fade-in will increase in an exponential way.
This sounds like the slider is just a copy of the start and end gain sliders but it is not. Such a slider would split a diagonal lines in two new ones, one steeper and one flatter than the pure diagonal line, whereas this slider is based on roots and powers and therefore with a rounded knee at the mid-point. If a user makes a “fade” from 100% to 100% and sets the mid-point at 0, he gets a curve like a tulip (the flower I mean) and has the perfect curve to remove unwanted sounds.
Internally, the curve would firstly be transferred to a triangle-like shape and then multiplied a few times by itself i.e. raised to a certain power.
I guess that the exponential version of PWL would return the desired results for all those cases.
But this is only a possibility among many. For the immediate benefit of the user it might be better to launch the plug-in as proposed by Steve and the (six) presets that Gayle has in mind.
Now for the Saving of the presets:
I propose that the settings of the preset appear after the name that the user has given, for example “pro CF [S-cve 50%]”.
Here, only the curve type and the mid-point value are saved.
I am willing to add this functionality to the plug-in.
I would as a first step introduce the last control from above and omit the feature with the user specific named presets.
The control would be named something like “Plug-in Settings” and contain the following:
- “Use current”
That’s the default and means that the settings of the controls are applied as usual. - “Save current as default”
This saves all relevant controls and reuses them for future sessions. - “Restore saved Settings”
Loads the saved settings, in case the user has made some changes during the session. - “Restore Factory Defaults”
Resets the plug-in to the state it had when it was installed for the first time.
In this manner, the user would be able to save at least one user setting (if no preset is chosen above) or to say which preset should be automatically be selected for each new session with the advantage that the necessary slider positions are the right ones for this preset.
I think that this would be enough for this plug-in. The expansion of the presets by user-defined presets is perhaps more appropriate for reverb and chorus effects. I try to provide you next week with a dummy plug-in that has this “Plug-in Settings” control built-in, just to show how it could be implemented.
i accord (agree) with mr robert , like the ram, u cant have enough preesets,
… In this manner, the user would be able to save at least one user setting (if no preset is chosen above) or to say which preset should be automatically be selected for each new session with the advantage that the necessary slider positions are the right ones for this preset.
That certainly looks an interesting idea Robert and worth exploring
I think that this would be enough for this plug-in.
I’'m minded to agree with you there - I would be worried about overcomplicating this effect for the user, I wouldn’t want us to frighten people off such a powerful and useful tool.
Peter
@Robert. Some of your ideas seem to be leaning toward a much more powerful / versatile effect than the version that is currently proposed. I’m not opposed to a more powerful effect, in fact I would favour such as an optional (download from the wiki) effect. You may be interested in having a look at the code in this much earlier version: More versatile Nyquist fade/amplify effect
The currently proposed version is the result of very long discussions about how to simplify the effect so at this stage I’m not keen to add more features. Gale has tended to push toward greater simplicity, yulac toward more sliders and presets and myself toward flexibility/functionality. I think that the current version is very close to a balanced compromise in that it offers a good amount of flexibility/functionality, has some sliders and presets and is about as simple as we can get it without unduly compromising the other two forces.
So to repeat my question “Is +51 log or cosine?” (if we don’t change)?
In a strict mathematical sense it is neither.
The curve is mathematically something like: y=(cos x)^(1 / (1 + c))
where “c” is the displacement above 50% Mid Fade Cut/Boost.
In practice, it is a “little more curved” than a cosine curve (like a cosine curve with the middle “pushed up a bit”).
The practical case is that if you want a “medium” amount of “upward” curve (like a bullet rather than like a trumpet bell) then set Mid Fade to 50% boost.
If you want a fade out to stay louder for a bit longer and then curve down a bit more steeply, increase the Mid Fade a bit higher.
If you want it less curved (more linear) then reduce the mid fade boost.

The currently proposed version is the result of very ityteam.org/viewtopic.php?p=84059#p84059long discussions about how to simplify the effect so at this stage I’m not keen to add more features. Gale has tended to push toward greater simplicity, yulac toward more sliders and presets and myself toward flexibility/functionality. I think that the current version is very close to a balanced compromise in that it offers a good amount of flexibility/functionality, has some sliders and presets and is about as simple as we can get it without unduly compromising the other two forces.
And I’m keen to get this to a stage where we can release it (and Pro Fade) to the wider Audacity user-base - targetting the impending 2.0.3. So I agree with Steve in not being keen to add more features just at this stage.
Once it has been formally released I’m sure we can attrract a lot more feedback from users than we just get on the forum here - and that will allow us to consider how we modify this effect in the future (and part of that should be a C++ implementation methinks).
I really do like Robert’s idea of user-saveable setting(s) but I do agree with Steve that right now is not the correc time to undertake major additions to the functionality. I’m not a Nyquist or a C++ programmer, but I’m guessing that this would probably be more easily done in a C++ version?
Peter

I think that the current version is very close to a balanced compromise in that it offers a good amount of flexibility/functionality, has some sliders and presets
I agree, though we must decide about the presets and positive/negative behaviour of the sliders. I set out the tradeoffs as I understand them.
If saving current parameters as a preset can be done transparently in Nyquist (I’d want to see how transparent) I don’t object to adding that to this effect, but it shouldn’t hold up proposing it for release, IMO.
I think six pairs of fixed presets is a reasonable compromise. I can live with presets at the bottom of the effect. Yulac, Robert and myself all like the idea of presets.
Gale
I think six pairs of fixed presets is a reasonable compromise. I can live with presets at the bottom of the effect. Yulac, Robert and myself all like the idea of presets.
Good, we have clear majority decision.
I think we finally have a specification for this effect.
we must decide about the presets
Having decided to have presets,
Gale’s list was:
Linear In/Out
Exponential In/Out *
Logarithmic In/Out *
Old Cross Fade In/Out
‘S’ Curve In/Out
- having some shape that doesn’t leave you listening to near silence for 1/3rd of the fade.
We all seem to be reasonably happy to go with this list.
I’ll change the name of “Old Cross Fade” to “Rounded” (as the best name suggested to date).
“Exponential” and “Logarithmic” presets:
These will be “mathematically accurate” fade shapes that are offset and normalized so that they fade between unity gain and silence.
The Log fade will give a gain of -3 dB half way through the duration of the fade.
The Exponential fade will have a useful amount of curve that doesn’t leave you listening to near silence for too long.
“Mid Fade Cut/Boost” will be renamed “Mid Fade Adjust” and will retain their current function:
Mid Fade Adjust > 0 produce curves that have greater gain than a linear fade mid way through the duration of the fade.
Mid Fade Adjust < 0 produce curves that have less gain than a linear fade mid way through the duration of the fade.
For fades between unity gain and silence:
Mid Fade Adjust = 50 will give a gain of -3 dB half way through the duration of the fade.
Sounds good to me, as far as I can tell.
I wonder, wasn’t there not also the quarter cosine curve? Not that I would miss it very badly.
However, it is my favorite type for short fade-ins (Sine curve 0° to 90°). It has that smooth curve at the end, in contrast to a pure linear fade, with its hard knee.

Mid Fade Adjust > 0 produce curves that have greater gain than a linear fade mid way through the duration of the fade.
Mid Fade Adjust < 0 produce curves that have less gain than a linear fade mid way through the duration of the fade.For fades between unity gain and silence:
Mid Fade Adjust = 50 will give a gain of -3 dB half way through the duration of the fade
OK and -50 gives a gain of -12 dB half way through for unity gain to/from silence, and all is exactly as per previous #30 versions, yes?

The Log fade [preset] will give a gain of -3 dB half way through the duration of the fade.
OK that is a “significant property” of an EQ Power fade , so let’s clarify - is this preset EQ Power or not?
For “education” I wonder if a slightly lower gain half way through say -4 dB doesn’t convey the logarithmic shape better?
My sixth preset (I suggested six) would then be the “cosine EQ power” fade which I compared with Square Root and Log EQ power fades here. Is this the cosine Robert wants or something else?
Gale
Sounds good to me, as far as I can tell.
I wonder, wasn’t there not also the quarter cosine curve? Not that I would miss it very badly.
However, it is my favorite type for short fade-ins (Sine curve 0° to 90°). It has that smooth curve at the end, in contrast to a pure linear fade, with its hard knee.
Thanks Robert.
If I understand you correctly, they are what I would call “medium convex curve”, so that’s:
Quarter cosine curve fade out: Fade down 100% to 0%, Mid Fade Adjust = +50.
Sine Curve Fade In (0 to 90°: Fade Up 0% to 100%, Mid Fade Adjust = +50.
OK and -50 gives a gain of -12 dB half way through for unity gain to/from silence, and all is exactly as per previous #30 versions, yes?
Yes/ I think that -50 gives us a fairy “medium convex curve”. Not too long close to silence on a Fade In/Out, but still a reasonable amount of curve.
#30 gives us the -3 dB on the “S Curve” at +100 rather than at +50. I think that it would be better if I change the scale a bit on the S-Curve to make it consistent with the other curves and gave a mid-fade duration amplitude of -3 dB at “50” for a fade in/out. (this gives a bit more range to the S-Curve shapes).
OK that is a “significant property” of an EQ Power fade , so let’s clarify - is this preset EQ Power or not?
Yes that can produce an “equal power crossfade”.
My sixth preset (I suggested six) would then be the “cosine EQ power” fade
I can add that, though it may not be so necessary as it can be quite easily achieved by using a “simple” Fade In between 0 and 100% gain with “Mid Fade Adjust” set to 50.
Do we want it? (Yes/No)
(1) I’m still voting for two pairs of EQ Power presets (one of which is “Rounded”, but of course neither is named as an EQ Fade explicitly).
(2) I think Cosine EQ Power is much better than Log (on its own terms and in difference from Square Root) for the second EQ Power. So that makes me think that the Log preset should not be EQ Power and would be better with a lower midpoint (to me, a lower midpoint always makes the shapes a bit clearer).
(1) is more important to me than (2), so if you strongly think the logarithmic must be the second EQ Power preset instead of Cosine EQ Power, then Robert’s pair of “medium convex curves” would be the sixth pair.
The choice:
(A) 6 pairs
Linear In/Out
Exponential In/Out
Logarithmic In/Out = EQ Power
“Rounded” = “Old Cross Fade” In/Out = EQ Power
‘S’ Curve In/Out
Medium Convex In/Out
or (B) 7 Pairs
Linear In/Out
Exponential In/Out
Logarithmic (lower mid point) In/Out
“Rounded” = “Old Cross Fade” In/Out = EQ Power
Cosine In/Out = EQ Power
‘S’ Curve In/Out
Medium Convex In/Out
I’m have not heard the Medium Convex curves but assuming they are “in” then I’ll vote for choice (B).
Gale
I didn’t want to confuse you with my curve but fortunately Steve has recognized which one I meant. The weird thing is that the basic function changes with the fade type used:
Fade-ins:
- S-curve = sine from -90° to +90° (raised by one,divided by 2), mid-fade = 0.5 (-6 dB)
- “medium convex” = sine from 0° to +90°, mid-fade = 0.707 (-3 dB)
- “medium concave” = sine from -90° to 0° (raised by one), mid-fade = 0.293 (-10.7 dB)
Fade-outs: - S-curve = cosine from 0° to +180° (raised by one,divided by 2), mid-fade = 0.5 (-6 dB)
- “medium convex” = cosine from 0° to +90°, mid-fade = 0.707 (-3 dB)
- “medium concave” = cosine from +180° to +270°, mid-fade = 0.293 (-10.7 dB)
Cross fade:
- S-curve can be used as it is (or with mid-fade adjust 50% for equal power) since it is symmetric.
- medium convex is only apparently equal power, but not symmetric (Not suited for cross fade).
mid-fade -50% gives a equal gain curve that can be used as cross fade. - medium concave has no similarity with an classic CF. A mid-fade adjust of +50% gives -5.33 dB.
I’ve included the concave variant for the sake of completeness. The curve starts slow and gradually morphs into a linear ramp, whereas the convex version starts linearly and then bends down when it gets near unity gain.
With a decreased (increased) mid-fade adjust, both types begin to resemble a S-curve, but the bulges are not divided equally, the picture is similar to half an old-fashioned light bulb.
I don’t know exactly what is meant by the “cosine Eq Power” curve from the 7 pairs above, I assume it is the s-curve with mid-fade adjust 50%.
A last cosine-based curve that I’ve been running across while researching the different fade-types is the “Double S”. It starts with the S-curve and reaches then the -6 or -3 dB level. It stays here for a while before going via another S-curve to 0 dB. It is specially suited for rhythmic drum patterns and cross-fades over one or more measures. However, since Steve’s plug-in supports partial fades, it can be achieved with the current S-curve in 3 (6) steps.
Re. comments from Robert J. H.
Fade In/Out do not have to be symmetric for an equal power fade (though they usually are in practice). The Fade Out and Fade in do not have to be the same “shape” (though again they usually are in practice). The defining feature is that from t=0 to t=d, where d = the duration of the crossfade and the curves are functions of “t”:
(in-curve ^ 2) + (out-curve ^ 2) = 1
This is obviously the case for the square root of a ramp and is also the case for a 1/4 phase cosine and many other fade shapes.
Any fades that satisfy this (or in practice, are close approximations) will produce constant power gain when mixing two uncorrelated signals. Of course, in practice the signals are unlikely to be totally uncorrelated so at best we are dealing with approximations.
Your once again totally right, Steve.
What’s more, The root of a quarter sine cycle is nothing but a raised cosine over 180°. In other words, I can get my quarter sine by selecting the S-curve ans positioning the mid-adjust fader to +50% - a preset that already exists. To show that it is the same:
(dotimes (num 19)
(print (expt (sin (* (/ pi 36.0) num)) 2.0))
(print (/ (1+ (cos(- (* (/ pi 18.0) num) (/ pi 1.0))) ) 2.0))
)
As you can see, the condition of symmetry (that refers to equal gain) is also fullfilled for this function. Mathematics are sometimes weird.
Mathematics are sometimes weird.
or beautiful