Midi Device to transform X/Y (from joystick) to Radius and Angle
Does anyone have a M4L device to do this. I want to be able to map my keyboard (SL73) joystick to the Omnisphere Orb effect which expects Radius and Angle.
I've just had a really frustrating afternoon with Claude AI trying to build this, but cannot seem to get to the point where I can output both Rad and Angle.
My joystick outputs on CC744 and 71, and I can get that to translate to outputs of CC21 or 20, but only one at a time.
I have not yet debugged the js script doing the translation because of the above issue. This is what Claude suggested for orb.js
But I suspect the underlying object structure is wrong (if I disconnect ctlout 21, I get CC 20 output, otherwise I only get 21):

>>>>>>>>>
inlets = 1;
outlets = 2;
var last_angle = 0;
function list(x, y) {
var radius = Math.sqrt(x x + y y);
radius = Math.min(radius, 1.0);
var angle_deg;
if (radius < 0.05) {
angle_deg = last_angle;
} else {
var angle_rad = Math.atan2(y, x);
angle_deg = (angle_rad * (180 / Math.PI) + 360) % 360;
last_angle = angle_deg;
}
outlet(0, Math.round(radius * 127));
outlet(1, Math.round((angle_deg / 360) * 127));
}
use poltocar
scale 0 127 -3.141593 3.141593
and maybe adjust rotation start point ?
don't know what that Orb expects as start point
Thanks - I'll take a look at that, but think that's a bit beyond my max skills. All I've ever done before is hack existing devices. Anyone seen this done before?
check the cartopol object's help file
here's an example of its use: https://cycling74.com/forums/rotating-coordinates-around-origin-for-gamepad-thumbstick-joystick
here CC 2 sends radius, CC1 angle.
radius is boosted a bit to circle without need to hit corners.
