convert XY data to azimuth and radius

Discuss problems and solutions.
Post Reply
acidan
Newbie
Posts: 28
Joined: 06 Feb 2012 13:19

convert XY data to azimuth and radius

Post by acidan »

Hi, I am working on a surround project

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

Image

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/re ... hworks.com
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: convert XY data to azimuth and radius

Post by oldgearguy »

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.
acidan
Newbie
Posts: 28
Joined: 06 Feb 2012 13:19

Re: convert XY data to azimuth and radius

Post by acidan »

Than you for the reply oldgearguy

Forgive me but I've not done any coding before and Im a newb with Lemur. I really need some help using that code. Would you take me through the steps please?
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: convert XY data to azimuth and radius

Post by oldgearguy »

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.
acidan
Newbie
Posts: 28
Joined: 06 Feb 2012 13:19

Re: convert XY data to azimuth and radius

Post by acidan »

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.
Post Reply