Page 1 of 1

converting XY coordinates to AD

Posted: 09 Jun 2013 20:08
by Audiorama
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 ? :(

Re: converting XY coordinates to AD

Posted: 10 Jun 2013 06:14
by Softcore
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

Re: converting XY coordinates to AD

Posted: 10 Jun 2013 07:39
by Audiorama
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 ?

Re: converting XY coordinates to AD

Posted: 10 Jun 2013 08:20
by Softcore
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!

Re: converting XY coordinates to AD

Posted: 10 Jun 2013 08:24
by Softcore
Here it is, applied - the distance is of course calculated in a range of 0 to 1

Re: converting XY coordinates to AD

Posted: 10 Jun 2013 08:26
by Softcore
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)

Re: converting XY coordinates to AD

Posted: 10 Jun 2013 16:02
by Audiorama
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 ...

Re: converting XY coordinates to AD

Posted: 10 Jun 2013 16:13
by Softcore
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!

Re: converting XY coordinates to AD

Posted: 10 Jun 2013 20:06
by Audiorama
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