Question About Vector Synth Style Joystick

AudioLemon's icon

Hello,

I would like to create a vector synthesis style joystick using the [pictslider] object. Essentially I would like 4 values to comes out. One for each of the 4 corners of the [pictslider]. If the [pictslider] is centered then I would like all 4 values to output 0.25. As I move to any corner I would like to increase it's corresponding value while reducing the 3 other values. When the [pictslider] is completely in one corner the corresponding value should be 1. and the three other values, corresponding to the other corners, should be 0. Essentially I would like to output a constant average of 1. - They way I do it now is not right.

I poked around for a half an hour or so but I seem to be just getting tongue tied with the numbers. If anybody could help I would greatly appreciate it.

AaronMButler's icon

This is a quad-fader that I made for a class project a while back. It worked close enough for my purposes, but it sometimes it outputs a few hundredths more or less than 1.

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

I'm interested in how others might make this more exact.

-Aaron

AudioLemon's icon

I found an old post on the SynthEdit forum that gave the formula - thanks to Dave Haupt.

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

EDIT: Thanks Aaron I was posting at the same time and missed your post. Your method looks cheaper than the one I found - it doesn't use as many expr objects. Good to have a choice - thanks.

AaronMButler's icon

That formula gives me the same slight deviations from 1. Now I'm curious as to how I can make this thing spit out a consistent "1."

Wishing I was better at math.

-Aaron

Jonas Magnussen's icon

Hey Aaron,

Your little patch saved me a lot of trouble for making the quad panner for my own project. Today I managed to make it consistent. The problem with your patch was that the calculations didn't really take Max's timing system into account. Because of that, if you clicked a place in the XY grid (note: clicked, not dragged, just getting a single XY coordinate from the pictslider), you would use some of the values from the previous calculations in the new calculation. In this workaround I fixed all the timing stuff, and I'm getting a consistent 1. as the summed value all the time.

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

Jonas

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

you also could use the nodes object.
its not exactly the same, but nearly ;-)

Jonas Magnussen's icon

Didn't even know about the nodes object! It looks really good, but it seems like the values have some kind of non-linear curve? If it can't give straight values it's not suitable for this purpose, in my opinion. Might just be me that have no experience with the object.

ncdlmn's icon

This solutions are really awesome and the Nodes object looks pretty cool and it is worth of further exploration.
Here is my solution for to turn the [pictslide] into a quad panner for the [pan4S] object that is built in Max.
The solution is a bit messy but makes some sense. If someone finds a way to simplify the operations in the [p pictodial] subpatch through expr, vexpr, or anything like that, feel free to give it a try.
Enjoy

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