How to apply multiple crossfaded effects?

Suppose I have a sound s, an effect f, and a crossfading envelope e. Defining g(s) as f(s) - s, then I add this to f:

  • e * g(s)

Suppose I want to apply two successive effects on overlapping intervals with crossfading. I imagine band stops with passbands well separated.The obvious is to add

  • e2 * g2( s + e1 * g1(s) )

But is this wrong, because the effects of f1 really get faded by the product of the envelopes? If the envelopes are the same piecewise linear rise, level, and fall, the square of the envelope is steeper sided, defeating the purpose of crossfading.

This might fix that:

  • e2 * g2( s + ( e1 / e2 ) * g1(s) )

It works nicely if the interval where e1 is positive nests in that where e2 is, and simplifies to a single crossfading of the composition of effects where the envelopes are the same.

But of course it divides by zero in the general case. So what about this: use the last formula where e1/e2 is less than some threshold. Compute again with the sequence of effects interchanged where e2/e1 is less than the threshold. Crossfade the two results over the interval where both are defined.

Does that make sense? I am thinking about how to generalize to more than two effects.

Hi Paul

Try -

1 Make a new V track on your edit so you have an empty ‘V1’ at the top of your Timeline
2 Open ‘Effects’ panel
3 Choose Video, Keying>Image Key
4 Drag and Drop the ‘Image Key’ FX straight to V1 - you’ll see it will expand (unfold) to an FX1 track
5 RT click, ‘Configure’ the FX1 effect
6 Choose your Logo file in the Image Keyer set-up panel ‘choose a file’, use Blend mode ‘in front’ should take into account alpha channel information in your graphic file [if it exists - transparency]. Scale, crop and position as required. You can position by clicking on the video window to do that with the mouse.

Hope that helps.

Thanks, but I have no idea what any of that means! I’m talking about a Nyquist programming problem.

Hi Paul
Your abstract example may be a little confusing.
I presume that you want to produce a notch in the original sound (1 - 0 - 1) and fill it with a modified version (0 - 1 0), in other words a double cross-fade. Cascading is normally the way to go.
The overall calculation is addition, not multiplication, the envelopes won’t be squared, but added up: ea + eb = e(a + b).
apply the different envelopes to the different functions (e.g. frequency bands), add them all up and normalize the new sound by 1 / number of envelopes.
Take the same envelopes and add them up separately, normalize them and substract them from one. This complement will now be multiplied with the original sound (new_s = (1 - norm(sum_env123)) * s + norm(env1f1(s) + env2f2(s) + env3*f3(s)).
That’s in the end all idle talk without a concrete problem to solve - there are too many constraints unknown.

Thank you for your enthusiasm, but please, if you don’t understand the question don’t post spurious replies.
Your post is a copy of a post from another forum and is totally unrelated to Audacity or to the question being asked. Sifting through misinformation is just a waste of everyone’s time.


I think I recognize the deesser code you shared in your desciption. This is different.

Think of the clicks I am trying to fix as certain tall and thin rectangles in the spectrogram. I fix each with a band stop by summing results of high and low pass filters with cutoffs dependent on the top and bottom levels. I do not add the passband back.

But it is possible for rectangles in different frequency ranges to overlap in time. If I treat each rectangle separately, what is the best way to combine repairs? I tried to explain why I thought that doing them iteratively might not be best. Could the repair applied first end up crossfaded less well, because the envelope is effectively multiplied by that of the second effect?

I don’t know yet how important this will be in practice.

While I have your attention, a different question. Is there a way to do in code what the equalization tool does? For each click I have information about which frequencies need how much reduction and perhaps it is crude just to choose one lowpass and highpass sufficient for the most prominent ones.

But I think much of this now is speculation running ahead of experiment.

Just passing through briefly - about to go to work :slight_smile:

Have a look at graphiceq.lsp (I’ve attached it as I don’t think it is included in Audacity). In particular, see: (defun nband-range (sig gains lowf highf)
grapheq.lsp (2.67 KB)


I see you simply apply eq-band repeatedly for each of the data points of the “curve.” I was thinking of writing exactly that for myself but I didn’t know if what the graphic equalization tool does is something different and better mathematically.

For now I am stepping frequencies linearly when testing for clicks, but if I step logarithmically instead, maybe I would miss a click but then I could use this code more directly.

I see eq-band has the possibility of varying the gain over the interval, just as I could vary the cutoff frequency with lp or hp.