Forums > MaxMSP

Help with ordering UDP data i'm receiving (blob detection)

September 9, 2010 | 11:43 am

Hello,
I’ve been trying to solve a problem for the past week and would be very grateful if someone could point me in the right direction for a solution. (This is my first time posting here in the forums)

I’m experimenting with blob detection data being sent via UDP, but i’m not using the cv.jit objects.

I’m using something called blosc (a standalone MacOsx program which tracks blobs and sends the data via UDP)
URL for info: http://www.s373.net/code/blosc/blosc.html

I’m receiving the data into Max via UDP, and if i print the UDP data (using ‘print udp’), the following data is sent to the Max Window.

udp: /blosc/data 0 0.246875 0.3375 0.001074
udp: /blosc/data 1 0.325 0.216667 0.000469
udp: /blosc/data 2 0.59375 0.2125 0.000456

the data is formatted as /blosc/data/

is the blob number (int)
, are the blob coordinates for that blob (float, float)
is the blob size (float)

I’ve managed to split the data using unpack, but my problem is ordering the data so i can use it effectively.

Ideally i would like to order the data dependent on the blob id.

so, if i receive /blosc/data 0 (then i’d like to output the x,y,area for blob 0).

and if i receive /blosc/data 1 (then i’d also like to output the x,y,area for blob 1)

I’ve tried using route, select, funnel, spray, coll but with no luck.

Currently i’ve managed to output blob 0
and assign (x to pan left right)
and also assign (y to raise or lower frequency)

But if more than one blob appears on the screen the data gets jumbled up.

Is it possible to filter the UDP data, dependent on the blob , and independently send the corresponding , , data for that blob only?

Apologies if i’ve not managed to explain my problem clearly, but i’d really appreciate if someone can help me.

Shown below is a simple patch to hopefully describe my problem more clearly.
Thanks if anyone can help.

– Pasted Max Patch, click to expand. –

(edit) Would it be easier to switch to OSC instead of UDP perhaps?


September 9, 2010 | 12:04 pm

Hi guylevens,

blosc sends OSC over UDP. You need to download [OSC-route] (search maxobjects.com, you’ll find it). Should be quite easy for you from there. If you have a variable number of blobs, each panning/controlling different sound objects, you may want to think about using poly~. Below is your patch with OSC-route, for reference.

best,
Zachary

– Pasted Max Patch, click to expand. –

September 9, 2010 | 1:59 pm

Thanks Zachary!

I just tried your patch (using OSC-route) and it seems a huge improvement on my earlier attempts. I can’t wait to start experimenting with it later.

I’ve spent the past couple of weeks trying to understand how to separate the blosc data and the information you’ve given is a massive help.

Thank you so much!
Guy Evans


September 9, 2010 | 2:02 pm

If I understand you correctly you could just use the ‘match’ object.

So: [match /blosc/data 0 nn nn nn]

[match /blosc/data 1 nn nn nn]

I think…


September 9, 2010 | 7:12 pm

Hi scatalogic,
I’ve not used the ‘match’ object yet, thanks for recommending it to me.
I’ll definitely have a read through its help file later to hopefully get a better understanding of its usage.

Thanks again for replying.


Viewing 5 posts - 1 through 5 (of 5 total)