Forums > MaxMSP

Receive UDP message from LabView

July 8, 2013 | 7:42 pm

Hi,
I’ve been trying to UDP message from LabView but no luck, here is the log from MaxMSP console.
Is there a way to unpack UDP packet from LabView? Thanks.

——– from print ——–
OSC packet size(6) not a multiple of 4 bytes
——– from printit (udpreceive port_number CNMAT) ——–
printit received MESSAGE "FullPacket" (17E1262C, s_thing 00000000) with 2 argument(s):
LONG 6
LONG 400544784
It looks like an OSC packet
but the size is only 6 bytes, so I won’t try to print it.


July 8, 2013 | 11:27 pm

Hi,

try [sadam.udpReceiver], from The sadam Library: http://www.sadam.hu/software .

HTH,
Ádám


July 9, 2013 | 12:13 am

Thanks Adam,
Now I send "123456" as string from LabView (using UDP write), and I use your sadam.udpReceiver in Max, then I see "49 50 51 52 53 54" in Max console. What might be the problem? encoding, endian, packet format.

If I send "abcdef", then I see "97 98 99 100 101 102".

O.O.


July 9, 2013 | 7:20 am

you’re receiving the values in their integer/decimal format. Refer to the all famous http://www.asciitable.com/

You can use itoa as demonstrated here

<code>

– Pasted Max Patch, click to expand. –

</code>


July 9, 2013 | 10:37 am

Indeed, you get everything byte-by-byte with [sadam.udpReceiver]. So, if you send it as a character string, you’ll receive bytes with the respective ASCII codes, which you can decode with the example by vjacobs (BTW, I think that you’d get the results even without the [zl iter 5] in the example).

Think about [sadam.udpReceiver] as a tool that gives you the exact byte stream that you send to Max, without any assumptions about the meaning of those bytes.

HTH,
Ádám


July 10, 2013 | 2:44 am

true indeed, zl iter is not necessary ;-)

btw, very useful set of network tools you have there…


July 25, 2013 | 9:19 am

Hi organicoscillator I am having exactly the same issue. Any chance we could communicate ? I would like to see your labview/max patch – I am trying to stream 8 changing floating point numbers separately in realtime from labview to max,

email : augustineleudar@gmail.com

cant seem to be able to send pms here anymore…..


July 25, 2013 | 11:24 am

Thanks Ádám for your library and vjacobs for your max patch.

Hi, Augustine, if you send out UDP from labview and use Ádám’s [sadam.udpReceiver] with vjacobs’ max patch, you should be able to decode msg from labview. what do u mean by pms?


July 25, 2013 | 1:08 pm

private messages
Ive tried all that to no avail – I dont get anything at all into max from labview with udp, or it doesnt like labview using the same port so say I use udp write on port 54321 it wont let maxsadam read from port 54321 because it says its already occupied etc etc I get absolutely no communication from labview to max with udpwrite and sadamudp receive (not even in the max window) and only with TCP if I stop running in labview and then it dumps a load of gobbldeygook in the max window….any chance of sending you my patches or looking at yours ?


July 31, 2013 | 7:52 am

hi

did you try with the [mxj net.udp.recv] object ???


January 25, 2014 | 5:35 pm

Here is my patch/hack, hope this helps.
{
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "scale 0.01 0.3 -10 10",
"numinlets" : 6,
"numoutlets" : 1,
"id" : "obj-77",
"fontname" : "Arial",
"patching_rect" : [ 971.5, 46.0, 129.0, 20.0 ],
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"id" : "obj-27",
"fontname" : "Arial",
"patching_rect" : [ 509.0, 195.0, 162.0, 20.0 ],
"outlettype" : [ "float", "bang" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"id" : "obj-26",
"fontname" : "Arial",
"patching_rect" : [ 1011.0, 183.0, 50.0, 20.0 ],
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"id" : "obj-69",
"fontname" : "Arial",
"patching_rect" : [ 929.0, 176.0, 50.0, 20.0 ],
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"id" : "obj-70",
"fontname" : "Arial",
"patching_rect" : [ 859.0, 176.0, 50.0, 20.0 ],
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "expr ($i1-48)*1+($i2-48)*0.1+($i3-48)*0.01+($i4-48)*0.001+($i5-48)*0.0001",
"numinlets" : 5,
"numoutlets" : 1,
"id" : "obj-22",
"fontname" : "Arial",
"patching_rect" : [ 688.0, 218.0, 409.0, 20.0 ],
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"id" : "obj-71",
"fontname" : "Arial",
"patching_rect" : [ 792.0, 174.0, 50.0, 20.0 ],
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"id" : "obj-72",
"fontname" : "Arial",
"patching_rect" : [ 709.0, 167.0, 50.0, 20.0 ],
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "unpack 1 1 1 1 1 1 1 1 1 1 1",
"numinlets" : 1,
"numoutlets" : 11,
"id" : "obj-19",
"fontname" : "Arial",
"patching_rect" : [ 786.5, 87.0, 159.0, 20.0 ],
"outlettype" : [ "int", "int", "int", "int", "int", "int", "int", "int", "int", "int", "int" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "48 46 50 53 51 50 57 54 13 10",
"numinlets" : 2,
"numoutlets" : 1,
"id" : "obj-73",
"fontname" : "Arial",
"patching_rect" : [ 545.5, 98.0, 194.0, 18.0 ],
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "route FullPacket",
"numinlets" : 1,
"numoutlets" : 2,
"id" : "obj-78",
"fontname" : "Arial",
"patching_rect" : [ 756.0, 27.0, 97.0, 20.0 ],
"outlettype" : [ "", "" ],
"fontsize" : 12.0
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sadam.udpReceiver 61557",
"numinlets" : 0,
"numoutlets" : 1,
"id" : "obj-79",
"fontname" : "Arial",
"patching_rect" : [ 700.5, -10.0, 154.0, 20.0 ],
"outlettype" : [ "" ],
"fontsize" : 12.0
}

}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-79", 0 ],
"destination" : [ "obj-78", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-78", 1 ],
"destination" : [ "obj-73", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-78", 1 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-72", 0 ],
"destination" : [ "obj-22", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-71", 0 ],
"destination" : [ "obj-22", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-70", 0 ],
"destination" : [ "obj-22", 2 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-69", 0 ],
"destination" : [ "obj-22", 3 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-27", 0 ],
"destination" : [ "obj-77", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-22", 0 ],
"destination" : [ "obj-27", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-72", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-19", 2 ],
"destination" : [ "obj-71", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-19", 3 ],
"destination" : [ "obj-70", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-19", 4 ],
"destination" : [ "obj-69", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-19", 5 ],
"destination" : [ "obj-26", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
]
}

It was used to convert ultrasound signal to audible signal in my project.


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