# Equal power crossfading 4 groups



## tonewill (Jun 7, 2014)

Hello,
I want to try an equal power crossfade between 4 groups using Big Bob's maths library. From what I've read, I'm not sure how to do more than 2. Can anyone nudge me in the right direction? Many thanks.


----------



## d.healey (Jun 7, 2014)

This thread might be useful to you: http://www.vi-control.net/forum/viewtop ... highlight=

Before you go down this route though there may be a better way to achieve the result your after. What are you attempting to crossfade, why do you need 4 crossfades? For example are you trying to crossfade through the dynamic layers of an instrument through 4 groups. Or are you trying to crossfade two groups into another two groups.


----------



## tonewill (Jun 7, 2014)

Hello David,
Thanks for the reply. I just read that post (well skimmed through it really) before posting this. I didn't read too much of it as I'm not after using the AET filter. What I want is simple really, just crossfading 4 dynamic layers (like you said) of an instrument between p and ff. Currently, the "modulation shaper" is being used for each group but it's using linear 'curves'. Can't really draw decent curves by hand with that I don't think.
Thanks again.


----------



## d.healey (Jun 7, 2014)

Your best choice is to use the modulation table - I've attached some curves to help you get started 

If you want to go the scripting way, have you tried Nil's crossfade script? 
http://nilsliberg.se/ksp/scripts/scripts.html#crossfade


----------



## tonewill (Jun 7, 2014)

Thanks David, much appreciated. The curves didn't work in my case unfortunately, volume was dipping much more than linear so it probably just doesn't match my instrument well.

I've tried Nils crossfade app in the past and it worked well, but I'd have to spend time working out the guts of it so that I can remove the interface and hard code the values. I had a feeling that it worked with note volume though, but I might have that wrong.

I take it that Big Bob's function is not capable of this them. I was thinking of making lookup tables from the output of the crossfade function by running it in a loop and getting the values for each step. Something like that anyway!


----------



## d.healey (Jun 7, 2014)

Bob's library just provides the maths, and you can most definitely achieve what you want with it but it may be quite tricky.

Sometimes a linear, or near linear, crossfade can work better than an equal power crossfade, it depends highly on the samples. Other times an S-shape is more appropriate.

From what you've written I'm guessing you're familiar with scripting a 2 note crossfade. Your 4 note crossfade can be thought of as three 2 note cross fades. So note 1 - 2, note 2 - 3, note 3 - 4.

You basically need to crossfade two notes, and when you are half way through the crossfade of the second note you bring in the third, and then the same between the third and the fourth. 

There are a few ways I can think of to get your script to determine the crossover points, if you are using a CC to control it then you can just hard code the crossovers at the appropriate CC values.


----------



## tonewill (Jun 8, 2014)

Thanks a lot David. I'll have to spend some time working it out. I'd like to see if I can get better than the linear that does have a bit of unevenness to the fade. I'm okay with scripting but not great with maths or conversions between different value ranges, but I'll give it a go.


----------



## d.healey (Jun 8, 2014)

Good luck


----------



## tonewill (Jun 8, 2014)

Thanks David.
After a lot of work I've managed to do it and it sounds quite good, surprisingly. I used a loop to iterate through all 1001 steps of Big Bob's EP_XFade function then converted the output arrays to the correct range for the volume engine parameter using the epVR function. I then had to compress the range from 2002 steps for a full up down/curve to about 84 I think it was to get 4 groups cross-fading in the range of 0-127 with the mod wheel. After more messing about cutting and pasting and padding with zeros I finally got 4 128 element arrays allowing me to cross-fade between 4 groups.


----------



## d.healey (Jun 8, 2014)

Cool, that was fast work!


----------

