Four-signal crossfade with [pictslider]

Brennon Bortz's icon

I'm trying to sort out a way to crossfade between four signals using a [pictslider]. The application seems obvious, and someone is bound to have done this before, but figuring out how to implement is eluding me!

Brennon Bortz's icon

To clarify, if the control point of the [pictslider] is all the way to any of the four corners, only one signal should be at full amplitude.

Roman Thilenius's icon

the first step is very simple.

when you have 4 signals A, B, C, and D, you would simply mix A vs B AND C vs D controlled by vertical movement, and then in a second step you would mix AB vs CD controlled by horizontal movement.

A B   C D
[+~]  [ +~]
AB   CD
[+~]
ABCD

of course, depending on the application, you might want some weighting (such as "equal power" when it is for a 2 speaker setup)

Floating Point's icon

the way I'd do it is get the coordinates and calculate the distance between the slider position and each of the 4 corners (using pythagorean method) and then independently attenuate the 4 sources according to how far the slider is from each of the corners (some sort of inverse relation. Then add them together.

Brennon Bortz's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Terry, that's the same thing I thought...but it doesn't fit the needs of my clarification, due to the square's geometry:

Brennon Bortz's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Roman, that did the trick--thanks! For reference:

Floating Point's icon
Max Patch
Copy patch and select New From Clipboard in Max.

yeah I see what you mean, only the diagonally opposite source is completely attenuated. You could change the scaling and have a floor of zero like this:

Roman's way looks neater, but I'd also get the sqrt of the four gain values for equal power crossfading

lee wang's icon

hello,

why not simply using the [nodes] object.
here is an excerpt from the nodes helpfile.

Max Patch
Copy patch and select New From Clipboard in Max.

best,
lee

Brennon Bortz's icon

What a sweet object--how have I not seen this before?!

oshii's icon

Yep, nodes is pretty nice object, however it still doesn't deliver 1 as a sum of the mixing, apart from corner positions.. Or am I missing something?

Untitled13.maxpat
Max Patch

oshii's icon

I'm still trying to achieve 4 audio signals mixing with [pictslider] with the goal to have a constant amplitude = 1. when the 4 guys are mixed. Now it seems pretty close, but there is still some slight deviation at certain positions. Any ideas?

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

above examples dont work for you?

oshii's icon

No, no luck. As I said none of them does for the reasons explained.

volker böhm's icon

order of execution is a very important topic in max. make sure you understand it.

Max Patch
Copy patch and select New From Clipboard in Max.

oshii's icon

oh.. i am a giddy goat! thank you! :)

exeterdown's icon

I was trying to achieve something similar which lead me to this thread.

There's some great stuff here - I still don't really understand the [!-] vs [-] objects, but I can see what they do different, and it was definitely something to consider in me achieving what I was trying to.

My goal was to create a mixer with any number of inputs, and as you bring each of the gains up, the others are inversely affected. So no matter what 'volume' each of the mixer channels is set to, the output is always at a kind of unity gain.

I was really just trying to use it to blend different oscillators - there's probably a better way of doing _that_ but I was also using it as an opportunity to learn.

I feel like there's a simple little expression, or patching technique, but I just can't quite picture it.
Here's what I managed to come up with, using that lovely [expr 1 - $f1] someone had above.

While the meters stay at the same level, even as I change the mixer values, I think I can tell from the scope that the whole structure doesn't really sit around the 0 mark - even though all the original signals are -1./1.

I also tried it with 'multiplying that total from the current signal level' instead of removing it, and it seems to work well too, but am not sure why I'd pick one or the other. Hope this is all relevant - thanks everyone!

Max Patch
Copy patch and select New From Clipboard in Max.


Roman Thilenius's icon


if it is what i think, it is a quite difficult thing.

try this:

make it having 2 operational modes

- one for mixing the channels against each other (when you lower the volume on channel 1 of 5 for 50%. the others will raise for 10% each),

- and one mode where the user would set the overall gain in the beginning (i.e. the desired sum of all gain values)

all other attempts to kill the bird with one stone will end up with you sitting in a padded cell.