Troubleshooting

convert XY data to azimuth and radius

Started by acidan on .

Sign in or create an account to join the conversation.

5 posts

Topic starter
Hi, I am working on a surround project

I want to use lemur to control a panning device in ableton live. see image below.

[img]http://i1179.photobucket.com/albums/x400/Dan_Monahan/M4L%20panner.png[/img]

From what I can see I need to somehow convert the XY data sent from a lemur device to control the azimuth and radius parameters of the max 4 live plugin.

I would like to use the 'ring area' object in the same way AB has done with 'AB-vEkTeR3' template https://liine.net/en/community/user-library/view/326/

I really don't know where to start on this. If anyone could shed some light on this I would be extremely grateful.

All the best

Danny

edit - I found this but I'm not sure how to implement it https://uk.mathworks.com/help/matlab/ref/cart2sph.html?requestedDomain=www.mathworks.com
this gets you closer:

azimuth = atan2(y,x)
r = sqrt(x.^2 + y.^2 + z.^2)

Lemur supports standard arctan (atan), but not atan2. See this wiki page for how you can use atan:
https://en.wikipedia.org/wiki/Atan2

What I would do is create a monitor object showing x, y, atan(y/x), and r. Then move the ring area around and see what's being produced. Adjust the atan result as necessary based on addition checks against x and y and per that wiki page.
I looked at it for about 10 minutes yesterday. I don't have much time this week or next; maybe someone else can jump in.

The RingArea may not do exactly what you want in the sense that the ring always moves back to the middle (or wherever you set the attractors). From you example, it looks like you want the ring to stay where ever you let go. The Multiball object (using only 1 ball) may be a better match.

Also - what you do want to send to Ableton? MIDI, OSC, what range of values? Is the azimuth sent as 0-127 or something else?

There's a lot of questions that maybe someone with familiarity with Abelton might be able to help with to move this along. The math to calculate azimuth is a bit tricky in that the Lemur objects use the lower left corner as (0,0) and the upper right as (1,1). The RingArea center is (0.5, 0.5) so the math might have to take into account those offsets.

Those are just some of the things that need thought.
to make the ring area behave like a static panner i have used the following in the objects behaviour box:
friction=z
speed=z

I think using midi will be fine especially as its for panning, the low resolution steps shouldn't be audible. Maybe OSC would be better in the long run but I want to keep things simple and just get something working to start with.