converting XY coordinates to AD

Discuss Lemur and share techniques.
Post Reply
Audiorama
Newbie
Posts:25
Joined:28 Apr 2012 22:29
converting XY coordinates to AD

Post by Audiorama » 09 Jun 2013 20:08

Hi everybody,

I'm trying to pilot the wonderful max4live plugin multichannel send nodes with Lemur.
(I use already the multiball object as an X,Y pad to do quadrophonic spatialization in Live, rather easy ;)
But this m4l plugin must receive Angle and Distance coordinates.
So how could I convert my x,y coordinates (sent by the multiball object) to a,d coordinates, before sending them to the m4l plugin ? :(

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: converting XY coordinates to AD

Post by Softcore » 10 Jun 2013 06:14

Based on the Pythagorean theorem I think you can calculate the distance between two points defined by x,y coordinates taking under consideration that they form a right-angled triangle with their x and y's being the legs and the distance being the hypotenuse.

Without digging too deep into it and checking if it is indeed true for all posible combos of x,y (location of points in each of the four cartesian, ermmm, is quadrants the correct english word?, not sure)....aaanyway.....I THINK (please do bother to check, Im not sure)

If we have point A (xA,yA) and point B(xB,yB) and their distance d then

d squared = (xB-xA) squared + (yB - yA) squared

therefore the distance d is

d= square root of ( (xB-xA)squared + yB-yA)squared)

For the angle, I dont have a clue! lol

EDIT: distance calculation confirmed, a few lines down in the wiki article above, just saw it! lol

Audiorama
Newbie
Posts:25
Joined:28 Apr 2012 22:29

Re: converting XY coordinates to AD

Post by Audiorama » 10 Jun 2013 07:39

thanks for your quick reply :D
i'm gonna precise my problem :
in a xy pad , you define usually the position of one point by two values on the two axes. that's what we can do with the multiball object, no ?
we can send two CCs or more (three in fact) in order to spatialize a sound in a quadrophonic space. (on a Ableton Live audio track, for instance)
Now, there is a very nice Max4Live plugin that can spatialize your sound on as many speakers you want (up to 12).
But in this plugin , the position in the square is defined in another coordinates mode , which is AD : Angle and Distance ...

My problem is : how can I convert the x,y coordinates (given by the multiball object) in these a,d coordinates in order to drive this spatialization in the m4l device ?

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: converting XY coordinates to AD

Post by Softcore » 10 Jun 2013 08:20

And Im gonna precise my answer....lol

The distance between two multiballs is

d= sqrt( (x[1]-x[0])^2 + (y[1]-y[0])^2)

For the angle, I dont know!

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: converting XY coordinates to AD

Post by Softcore » 10 Jun 2013 08:24

Here it is, applied - the distance is of course calculated in a range of 0 to 1
Attachments
balls-distance.jzml
(5.04KiB)Downloaded 107 times

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: converting XY coordinates to AD

Post by Softcore » 10 Jun 2013 08:26

obviously if you want distance from 0 point (0,0) of ONE point (one ball) then you replace with zero so....

d = sqr(x[0]^2-y[0]^2)

Audiorama
Newbie
Posts:25
Joined:28 Apr 2012 22:29

Re: converting XY coordinates to AD

Post by Audiorama » 10 Jun 2013 16:02

thanks for your response.
Sorry, but I have only one ball in my object ...
so I think you probably don't know what is xy and ad coordinates modes ...

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: converting XY coordinates to AD

Post by Softcore » 10 Jun 2013 16:13

BTW this one does what you want and it accepts those things i dont know of, x,y coordinates!

http://www.maxforlive.com/library/devic ... send-nodes

As for the initial Distance/Azymuth thing, yes I really dont have a clue what M4L means with Distance and Azymuth but ANY distance of ANY point towards ANY other reference point could still be calculated by what I said earlier!

Audiorama
Newbie
Posts:25
Joined:28 Apr 2012 22:29

Re: converting XY coordinates to AD

Post by Audiorama » 10 Jun 2013 20:06

Thanks a lot ! you found the device i'm looking for :D
you're certainly right about your calculations, but it was not what i expected, you see ?
many thanks

Post Reply