Cross-Fade (revisited)

OK so we lose the “Fade Length” box and we have a “deletion” or “limit” or “” feature that is clearly off-by-default, so I think we’re getting somewhere. Basic users can now click OK without changing anything and always get a result.

So “x” is 1/2 the selected length. Are you going to error for x > 1/2 the selected length, or treat that as meaning “0”? Would “treat as zero” be less irritating?

I still wonder if matching the slider value to the selection length is going to be a lot of hassle? Can you see a way of doing this as a “Compression %” or similar? I don’t know if “limit” is the expected term, but as only a casual cross-fade user I would find a % more intuitive and less fiddly most of the time. I suppose a % would go from 0 (off) to 99.9%? I don’t mind an option for seconds instead of %.

I do think we should have a clear idea of how many amplitude plug-ins we are going to propose for Audacity distribution in the near future. Personally I think a text envelope is very important for Audacity, but I doubt if we can “sell” more than two amplitude plug-ins. So is a text envelope viable for advanced users of fades without excess complexity? If not, then as long as we have some arrangement as above with an off-by-default “limit/deletion” control, I really don’t mind fade in and out being in Cross Fade.

Why remove the “Shape” control? It could be useful whether we leave fade in/out in Cross-Fade or not.


Yes, though to get a correct result they must select an equal duration of each of the tracks.

“x” is the duration of the fade-out.
“x” is also the duration of the fade-in.
“x” is also the duration of the final cross-fade.
By default, “x” is equal to half of the selection.
The “Limit” control sets a maximum value for “x” (it places a limit on how long the cross-fade will be).

This means that there is no need for an error message:
If the “Limit” control is set to zero (default), the control is disabled and “x” will default to half of the selection length.

Looking at some examples: (for clarity I will refer to the fade-out duration, fade-in duration, cross-fade duration and “x” {which are all equal} as “fade length”)
Selection length 10 seconds, “Limit” set to zero, the fade length will be 5 second.

Selection length 10 seconds, “Limit” set to 10 seconds, the fade length will be 5 second. (the fade length is less than the “Limit”)
Selection length 10 seconds, “Limit” set to 9 seconds, the fade length will be 5 second.

Selection length 10 seconds, “Limit” set to 6 seconds, the fade length will be 5 second.
Selection length 10 seconds, “Limit” set to 5 seconds, the fade length will be 5 second.
Selection length 10 seconds, “Limit” set to 4 seconds, the fade length will be 4 seconds. (the fade length has been limited to the value set).

Lets look at an example of what makes the “Limit” control so very useful:
You have 2 songs to cross-fade (song “A” and song “B”).
You want song A to start a fade-out at 3:02.5 from the start of song A. (this will be the start of the cross-fade - call it “point a”)
You want song B to be fully faded-in at 0:32 from the start of song B. (this will be the end of the cross-fade - call it “point b”).
You want a 5 second cross-fade.

Without using the “Limit” control, the process would be:

  1. Trim song A to 3:07.5 (“point a” + the fade duration).
  2. Delete the first 27 seconds from song B (“point b” minus the fade duration).
  3. Butt the two songs together end to end.
  4. Select from 3:02.5 (the start position of the cross-fade) to 3:12.5 (the end position of the cross-fade).
    If I’ve got the calculations correct, there will now be 5 seconds of song A selected and 5 seconds of song B selected.
  5. Click “OK”.

Using the “Limit” control, the process would be:

  1. Butt the two songs together end to end.
  2. Select from “point a” to “point b”
  3. Set the “Limit” to 5 seconds.
  4. Click “OK”.

I’ve uploaded a full-featured text envelope here:
Personally I think that it is too complex for Audacity distribution, but it has functionality close to what is available with the Envelope Tool and does not require a mouse.

Most of the same functionality can be achieved with a much more simple fade effect. The difference being that the “Text Envelope” can apply an arbitrary number of “control points”, whereas a more simple fade effect would have just an initial level, a final level, and would extrapolate between the two. What this means practically is that if you want to fade a track down to half volume and then back up, the Text Envelope can have control points set at the start, the end, and as many points between as necessary to achieve the desired shape. Using a more simple fade effect it would be necessary to apply the effect in two sections.

I’m not proposing to remove the “Curve” control. I’m only proposing to remove the “S” shape option.

By far the most common fade curve for cross-fades is a slightly “positive Curve”. (a curve in the opposite direction from the Envelope Tool curve).
Use of an “S” curve is very common for fade-outs, but pretty rare for cross-fades, so I am inclined to remove the “S” curve option from the cross-fade effect, but retain it as an option in the “Fade” effect. (Advanced users that specifically want to use an “S” curve in a cross-fade can do so by making the cross-fade manually using the “Fade” effect).

OK, so I view that as equivalent to "x > 1/2 the selected length is treated as “0” ". Good.

I’ve never argued against deleting audio if it doesn’t happen by default. I think deletion should be in, but I’m unsure about the presentation of it, indeed I suspect beginners who fancy trying something other than the default fade may find this much harder to grasp than you think. I think presenting this e.g. as “Custom fade length” or “Shortened fade length” would be far easier (I’m conveying the principle of what’s happening rather then suggesting an exact description, trying to make clearer that audio is being lost ).

And I still think there may be a case for presenting it the other way round as a deletion length or compression percentage.

Either way, I would go ahead with a mockup with Fade in/Out removed for now, though I am not sure if that’s any longer the best idea (Fade Shape is out as well in that case,as you say).

Bill, you’ve been quiet, but what do you think? Do you still want more power than fade in/out in Cross Fade would provide? My idea of using Text Envelope for advanced fades was just as Steve pointed out (multiple control points). I have not looked at Text Envelope yet. Do you (Steve) regard it as finished (for Wiki purposes)?

And sorry if it’s a dumb question, but I have a 0.3 amplitude 400 Hz tone abutting 0.3 noise at 3.2 s. I have generated 500 ms of full scale 1000 Hz tone equidistantly either side of 3.2s. I select from 2s to 4s and do a Cross Fade with length of 1s with the “Simple” Fade Shape. Why does the blip of 1000 Hz tone end up at 2.15 s rather than just after 2.5s which would have kept it just after half way through the new selection?


I’m in favour of any interface that does not require the user to do calculations.

Is there any way in Nyquist to determine the length of the selection and report it in the dialog? If so, is it possible to set the Fade Length control to half the selection length?

When using the “Limit” control, is there any way to report the threshold at which audio deletion will take place?

Is it possible to have separate drop-down menus for fade-out and fade-in? Instead of the “Curve” control, I’d prefer to have presets such as Fast, Linear, Slow, Equal Power and Slam [or whatever is common parlance for a cold start/stop].

– Bill

For testing purposes I’ll make up simplified cross-fade effects (linear fade only) so that these alternatives can be tried.

In terms of functionality, yes (it does what it is intended to do).
The forum topic for the Text Envelope is here:

Fade Shape does not have to be out, but personally think that if Fade In/Out is available as a separate effect then the case for including the “S” shape fade in the cross-fade effect is quite weak and not worth the extra control.

Me too. Especially not calculations that have to be exact to n decimal places.

The Audacity/Nyquist plug-in GUI is part of Audacity and not part of Nyquist. The GUI does not support interactivity, so controls can not be greyed out, or set to values based on other values in the interface, or set according to any properties of the selection.

Nyquist can determine the total length of the selection, but Nyquist only has access to the selection after the OK (or Debug) button has been clicked.
Nyquist can not see splits or white space in the selection, so it is not able to determine where one audio clip ends and the other begins.

When using the “Limit” control, audio deletion will occur when the selection duration is greater than the combined duration of the fade-in and fade-out.
This cannot be displayed in the plug-in GUI as Nyquist only knows the duration of the selection after the OK (or Debug) button has been clicked.

Deletion will only occur if the “Limit” is set greater than zero (“Limit” is disabled when set to zero) and less than half of the selection duration.

I’m not keen on “Custom fade length” as this implies (to me) that the control will set the length. In the current version, the control will only set the fade duration if the selection is long enough for both the fade-out and the fade-in. If the selection is not long enough for the “set” duration, then only the first half of the selection is used for the fade out and the final half is used for the fade-in.

It is possible to make a plug-in where “Custom fade length” will set the length even if this length is more than half of the selection, but the results of doing this can be quite bizarre. For example, if the selection is 10 seconds of which the first 5 seconds are the end of “song A” and the final 5 seconds is the start of “song B”, then setting the “Custom fade length” to say 8 seconds will create a cross-fade such that the fade-out section is the first 8 seconds of the selection and the fade-in section is the final 8 seconds of the selection. However, in this case the initial 8 seconds of the selection has 5 seconds of “song A” and 3 seconds of “song B” and the final 8 seconds has 3 seconds or “song A” and 5 seconds of “song B”. The only way that I can see to sensibly resolve this and avoid such a weird cross-fade is to throw an error if the “Custom fade length” is greater than half of the selection duration. Other than the word “Custom” this is exactly what I had in the version that I first posted in this thread.

I think that something like “Shortened fade length” may work.
What we really want to say in 5 words or less is something like:
“If the selection is sufficiently long, use only the first x seconds for the fade-out, the final x seconds for the fade-in and delete the region between, otherwise use the initial half of the selection for the fade-out and the final half for the fade-in”.

How about if the control said: “Cross-fade duration” and if the selection is not at least 2x the duration set by this control then an error message is returned with something like (the numbers could be the actual values used):

“To create a 5 second cross-fade, 5 seconds is required
at the start of the selection for the fade-out AND
5 seconds is required at the end of the selection for the
The selection was only 8 seconds, so the maximum
cross-fade duration for this selection is 4 seconds.”

Is it not obvious that creating (for example) a 5 second cross-fade from a 20 second selection will delete some of the selection? (The info text and the Help screen can both say that this will happen).

I suppose that we could have a multiple choice control:
Action: “Fade only” or “Fade and Trim” or “Cross-fade”
“Fade Only” will apply the fade-out and fade-in but will not delete any audio and will not move/mix the fades.
“Fade and Trim” will apply the fade-out and fade-in and will delete (trim) any excess between the two fades.
“Cross-fade” will apply the fade-out and fade-in, will delete (trim) any excess between the two fades, and will move/mix the two fades to create a cross-fade.
I don’t personally like this idea but I think that it would make it clear what the cross-fade was doing. The downside is that options 1 and 2 are pretty pointless and only option 3 does what the plug-in is intended to do.

I don’t want to dumb down this effect to the point where it ceases to be useful. Even the initial version of this plug-in was “idiot proofed” by Ctrl+Z.

Sorry I can’t follow that description.
Could you export the track before processing and post it as an attachment?

Three test versions:
cross-fade-a.ny (1.16 KB)
cross-fade-b.ny (1.21 KB)
cross-fade-c.ny (916 Bytes)
These test versions only have linear fades only, no help screens, minimal error checking and require mono tracks.

They don’t work. Either “Nyquist returned” and a number, or a ramp in the crossfade region.

– Bill

Done, but I also included a 100ms_blip.wav with a 100 ms “blip” centred on 3.2 s which shows what I am querying more clearly.

Just turn Snap To on, select from 2s to 4s and the “Fade Length” to 1s (in the last working plug-in).


Sorry I forgot to say they require mono tracks.

Try making the cross-fade manually.

You want a 1 second cross-fade, which will require a 1 second fade-out down from the 2 second mark and a 1 second fade-in up to the 4 second mark.

  1. Select from 2 to 3 seconds and apply a fade-out
  2. Select from 3 to 4 seconds and apply a fade-in
  3. Split the track at 3 seconds
  4. Create a new track
  5. Move the second audio clip to the second track
  6. Drag the second track so that it starts at 2 seconds
  7. Select all then Mix and Render.

Now compare with using the plug-in.

  1. Select from 2 to 4 seconds.
    1a) Set the “Limit” or “Fade Length” to 1 second (optional if using the version with “Limit” because you are using exactly half of the selection for each fade, which is the default action)
  2. Apply the cross-fade.

Duh, I should have been able to figure that out from looking at the code. :frowning:

I think version A is the clearest in terms of what will happen and the easiest to understand.

The control in version B doesn’t seem to do anything - no matter what setting I make I get a cross-fade length that is half the selection length.

In version C, I find the concept of “Compression percentage” difficult to grasp.

– Bill

I like the idea that there is one slider that controls the “length” of the crossfade by specifying if and how much audio is removed from the middle of the selection.

The addition of fade shape dropdowns for the fade-out and fade-in would make it much more powerful without adding too much complexity.

My preferences would be:
Equal Power (default)
Slam/Cold (no fade) (whatever the correct parlance is for this kind of “fade”)

– Bill

I do like the idea of presets, but as revealed by previous attempts to make a more versatile fade effect, there is a major drawback. There is no correct, (or even any common) “parlance”.

The terms “fast” and “slow” are more likely to suggest fade duration rather than the fade shape, and even if used as a phrase such as “fast shape” or “slow shape”, what does that actually mean? Which of these two fades is “fast” and which is “slow”?
Looking on the Internet there is not even agreement about what an “Exponential” fade is and what a “Logarithmic” fade is.
I think this lack of common terminology probably kills the idea of presets (especially as the help screens do not support pictures), unless someone can think of a really cleaver and transparently clear way to describe curve shapes.

The reason that I’ve now opted for a “Curve” value, is that there IS a commonly adopted meaning (albeit in the somewhat specialist realm of DJ mixing desk cross-faders). It is also quite easy to grasp the principle that an increased “Curve” value will make the mid-fade level higher.

That’s strange. I’ve just downloaded it (to check that I had uploaded the correct code) and it works perfectly.

Sadly it is also the most difficult to work out how long the cross-fade will be and the cross-fade duration is probably the most important property of the cross-fade.

I suspect that part of the “problem” with these cross-fade plug-ins comes from testing with signals rather than music.
Here’s a couple of tracks from Renaissance 2011 by BADLUCK (Creative Commons License conditions)
Track 1: BADLUCK_-04-_Got_Hits.mp3
Track 2: BADLUCK_-10-_Wake_Up_Wit_Me.mp3
Let’s say that you want to make a 5 second cross-fade, starting at 2 minutes and 30 seconds in track one (the final word in the song) and you want track 2 to be fully faded in at 12.414 seconds (just before “Hello”).

With no prompting or guidance other than the text on the interface, see if you (anyone, this is not specifically directed at Bill) can accomplish this using this plug-in (below), and if so, how easily. The plug-in is basically the same as cross-fade-b.ny but supports stereo tracks.
cross-fade-d.ny (1.21 KB)

OK, point taken. Version D is easiest since the slider specifies the cross-fade length. Setting it to 5 seconds creates a pleasing cross-fade in this case. The selection at the end of track 1 is 10.201 seconds and at the start of track 2 is 12.414 seconds so a “cut in half and fade each half” won’t work. Deleting audio is the equivalent of a) fading track 1 out before it ends and b) starting track 2, waiting a few seconds then fading it in.

I’m not the best one to be testing this. For mixing music I prefer to have the songs on separate tracks, rehearse the overlap then choose a fade. However, I really like the speed of this cross-fade effect for tightening up live recordings by removing applause and noodling between songs.

– Bill

I should probably also have said that I did not specifically choose the songs to show off the effect in the best light - I just Googled “Creative Commons” and followed the links to an album, then picked two tracks from the album. I did however choose the edit points with some care :wink:

Yes, me too, (that is why I included Fade-in/out in the first version), but as you say, this plug-in is really quick as it reduces a 7 step procedure to just a couple of clicks (and it’s brilliant for trimming down “applause and noodling” in live recordings).

Another really good use for this effect is for seamlessly removing big clicks that cannot be removed any way other than cutting them out. Just select a bit of space either side of the click and set a really short cross-fade. I’ve been using a plug-in similar to this for quite a lot of restoration work and it is a huge time saver.

I appreciate you are demonstrating that Cross-Fade moves the second half left, but my point is that we’ll probably need to explain this (and generally we may well have to make it clear to beginners that even if audio is not deleted, the end of the track will appear to be). I am basing this on evidence as I have had some people totally fazed by the Cross Fade variants when I’ve recommended them.

In my case what I probably want to do is move the first half right by 0.5s and the second half left by 0.5s. Or I might care that the blip stays at 3.2 s so want to move the first half right by 1s.

Do we need an option to do either of those in Cross-Fade? Or is it too oddball? If it’s too oddball (you have to do this manually with Fade Out/In and TIme Shift), maybe it slightly strengthens the case for keeping fades in Cross_Fade?


I’d have said that the top one is fast and the bottom is slow because the bottom one takes much longer than the top one to get to the same point.