Forums > MaxMSP

Osc to Max/Msp form Quartz Composer… (hex to float)

September 1, 2008 | 11:01 am

Dear Reader,

I am receiving a string with osc (udpreceive) in Max/Msp.
The string is made of hexadecimal data.

How could I separate the string and how is it possible to get a float from the hex characters?

http://www.tedor2.extra.hu/osc.jp2

Help appreciated!
All the best,
Krisztian


September 2, 2008 | 1:39 pm

hi
Could you send us more details, a sample from this string?

your .jpg is very fuzzy , I can’t read anything

I am curious beacause usualy OSC is made of plain text.

olivier


September 2, 2008 | 2:27 pm

Hi,
first, thank you for the reply!

I guess it is going to be difficult for you to see the same data, as you would need the EEG DEVICE, but his might helps.

(i)

I could sort out to get integers from hex data, was not very difficult at all:)

(ii)

There are two more pictures which might help:

http://www.tedor2.extra.hu/uploads/osc1.jpg

http://www.tedor2.extra.hu/uploads/osc2.jpg

(iii)

This is the patcher I am using in Max/Msp:
(You might see the remaining data in the message box.)

{
"patcher" : {
"fileversion" : 1,
"rect" : [ 1280.0, 110.0, 1024.0, 720.0 ],
"bglocked" : 0,
"defrect" : [ 1280.0, 110.0, 1024.0, 720.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"metadata" : [ ],
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "sprintf %s%s",
"outlettype" : [ "" ],
"id" : "obj-32",
"fontsize" : 11.595187,
"patching_rect" : [ 303.0, 188.0, 78.0, 20.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "X12e 156 2 2 2e5 2f6 3 2 1f8 1f7 2 2 3 1 2 2",
"outlettype" : [ "" ],
"id" : "obj-48",
"fontsize" : 9.0,
"patching_rect" : [ 308.0, 223.0, 518.5, 15.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print bang",
"id" : "obj-10",
"fontsize" : 9.0,
"patching_rect" : [ 14.0, 289.0, 53.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "OpenSoundControl",
"outlettype" : [ "", "", "" ],
"id" : "obj-1",
"fontsize" : 9.0,
"patching_rect" : [ 14.0, 260.0, 88.0, 17.0 ],
"numinlets" : 0,
"numoutlets" : 3,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print messages",
"id" : "obj-2",
"fontsize" : 9.0,
"patching_rect" : [ 49.0, 308.0, 75.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print time-tag",
"id" : "obj-3",
"fontsize" : 9.0,
"patching_rect" : [ 83.0, 289.0, 72.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "p cnmat_compatibility",
"id" : "obj-5",
"fontsize" : 9.0,
"patching_rect" : [ 188.0, 37.0, 109.0, 17.0 ],
"numinlets" : 0,
"numoutlets" : 0,
"fontname" : "Arial",
"patcher" : {
"fileversion" : 1,
"rect" : [ 1582.0, 205.0, 385.0, 293.0 ],
"bglocked" : 0,
"defrect" : [ 1582.0, 205.0, 385.0, 293.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"metadata" : [ ],
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "udpreceive 7374 CNMAT",
"outlettype" : [ "" ],
"id" : "obj-1",
"fontsize" : 9.0,
"patching_rect" : [ 43.0, 142.0, 121.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "Both udpsend and udpreceive support the ‘FullPacket’ message used by the CNMAT OpenSoundControl external. This means they can be used as drop in replacements for the [otudp] object.",
"linecount" : 3,
"id" : "obj-2",
"fontsize" : 9.0,
"patching_rect" : [ 21.0, 27.0, 299.0, 38.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "Although udpsend and udpreceive use OSC as their transport protocol, the OpenSoundControl object by CNMAT has more robust support for OpenSoundControl as a protocol including bundling of multiple OSC messages, string substitution, time stamping etc. udpsend and udpreceive support a simple subset of OSC.",
"linecount" : 5,
"id" : "obj-3",
"fontsize" : 9.0,
"patching_rect" : [ 20.0, 173.0, 296.0, 58.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "udpsend will respond to the ‘FullPacket’ message as expected. However, for udpreceive to know that it should pass on udp buffers as ‘FullPacket’ messages instead of decoding them itself you need to instantiate it with an optional third argument.",
"linecount" : 4,
"id" : "obj-4",
"fontsize" : 9.0,
"patching_rect" : [ 22.0, 70.0, 261.0, 48.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

}
],
"lines" : [ ]
}
,
"saved_object_attributes" : {
"fontface" : 0,
"fontsize" : 12.0,
"default_fontface" : 0,
"globalpatchername" : "",
"default_fontname" : "Arial",
"default_fontsize" : 12.0,
"fontname" : "Arial"
}

}

}
, {
"box" : {
"maxclass" : "message",
"text" : "maxqueuesize 512",
"outlettype" : [ "" ],
"id" : "obj-6",
"fontsize" : 9.0,
"patching_rect" : [ 9.0, 73.0, 86.0, 15.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print receivedmess",
"id" : "obj-12",
"fontsize" : 9.0,
"patching_rect" : [ 81.0, 227.0, 95.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "set local port to listen for messages on",
"linecount" : 2,
"id" : "obj-13",
"fontsize" : 9.0,
"patching_rect" : [ 188.0, 96.0, 131.0, 27.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "port 7005",
"outlettype" : [ "" ],
"id" : "obj-14",
"fontsize" : 9.0,
"patching_rect" : [ 128.0, 114.0, 56.0, 15.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "port 7401",
"outlettype" : [ "" ],
"id" : "obj-15",
"fontsize" : 9.0,
"patching_rect" : [ 120.0, 94.0, 55.0, 15.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "udpreceive 7005",
"outlettype" : [ "" ],
"id" : "obj-24",
"fontsize" : 9.0,
"patching_rect" : [ 83.0, 143.0, 86.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "udpsend & udpreceive",
"frgb" : [ 0.082353, 0.219608, 0.035294, 1.0 ],
"id" : "obj-25",
"fontsize" : 18.0,
"patching_rect" : [ 5.0, 5.0, 212.0, 27.0 ],
"numinlets" : 1,
"textcolor" : [ 0.082353, 0.219608, 0.035294, 1.0 ],
"numoutlets" : 0,
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "argument is port",
"id" : "obj-33",
"fontsize" : 9.0,
"patching_rect" : [ 176.0, 144.0, 100.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"fontname" : "Arial"
}

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

}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ 129.5, 139.0, 92.5, 139.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ 137.5, 139.0, 92.5, 139.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ 18.5, 139.0, 92.5, 139.0 ]
}

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

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

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

}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-32", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
]
}

}

(iv)

The explanation of the developer might helps as well:

//

just you need to get data "one packet = 4 data".

doesn’t mater you get how many pack of data in one line.
that is depend on machine speed and your data pool programming method.

in case that is not good programming then you may loss some of data from IBVA hardware.
anyway CH 3, CH4 data is usually "000", "001" "002", "003".
so you can find which one is data 1, 2, 3, 4
then make new line , line feed for make print to next line. "n"

CH1 , CH2, CH3, CH4 is data order.
each data is 10 bit : 000 .. 3ff (hex)

10 bit : 000.. 3ff

000 is 0V input. -> -2.5 V AD input ( – 100 micro V brain wave input )
200 is 2.5V input. -> 0 V AD input( 0 micro V brain wave input )
3ff is 5V input. -> +2.5 V AD input ( + 100 micro V brain wave input )

10 bit mean 1024 resolution from +-100 micro V brain wave input. ( 200 micro V full scale )
1 resolution is 0.1953125 0 micro V ( 200 micro V / 1024 )

————–
only CH1 and CH2 ( left and right ) use.
CH3 and CH4 is not connect. (-2.5V connection that inside IBVA hardware )

ex data
< <
CH1 CH2 CH3 CH4

221 18f 003 002
222 121 002 002
1b8 0f6 002 002
181 0b3 002 002
1ad 0fb 002 002
1de 144 002 002
20f 187 002 002
239 1ea 002 002
>>

masahiro

//

Thank you,
best,
Krisztian


September 2, 2008 | 3:40 pm

Hi Krisztian,

So if you made it with hexa to integer, I guess your next step will be to manipulate and sort the datas from the lists coming from osc

I suggest to have a look at [zl] object, this one is very powerfull with lists

just be sure to send the datas as a list, if you have trouble with this use [threshold] to combine a flow of datas into list.

if you can’t find what you are looking for ask us again with an explicit example like:

"I got this list ….and want to extract this…"

good luck

olivier


September 2, 2008 | 6:09 pm

hi Olivier,

thanks for the idea, I will be working on it!

best,
Krisztian


September 3, 2008 | 2:40 pm

hi,

I got definitely closer with [zl], it is very useful.

But I got stuck as I do not know how the get the hex data into a numberbox! (Please have a look in the patch.)

All the best,
Krisztian

{
"patcher" : {
"fileversion" : 1,
"rect" : [ 1280.0, 110.0, 1024.0, 720.0 ],
"bglocked" : 0,
"defrect" : [ 1280.0, 110.0, 1024.0, 720.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"metadata" : [ ],
"boxes" : [ {
"box" : {
"maxclass" : "flonum",
"numinlets" : 1,
"numoutlets" : 2,
"patching_rect" : [ 151.0, 504.0, 50.0, 20.0 ],
"fontsize" : 12.0,
"outlettype" : [ "float", "bang" ],
"id" : "obj-11",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "Ok, message to nb box with integer works, but not with hex, idea? thx",
"linecount" : 3,
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 432.0, 475.0, 154.0, 48.0 ],
"fontsize" : 12.0,
"id" : "obj-9",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"patching_rect" : [ 369.0, 502.0, 50.0, 20.0 ],
"fontsize" : 12.0,
"outlettype" : [ "int", "bang" ],
"id" : "obj-8",
"fontname" : "Arial",
"presentation_rect" : [ 369.0, 502.0, 0.0, 0.0 ]
}

}
, {
"box" : {
"maxclass" : "number",
"numinlets" : 1,
"numoutlets" : 2,
"patching_rect" : [ 262.0, 501.0, 50.0, 20.0 ],
"format" : 1,
"fontsize" : 12.0,
"outlettype" : [ "int", "bang" ],
"id" : "obj-7",
"fontname" : "Arial",
"presentation_rect" : [ 262.0, 501.0, 0.0, 0.0 ]
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1f5",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 676.0, 406.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-68",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "20b",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 617.0, 406.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-69",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1eb",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 562.0, 407.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-70",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "219",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 507.0, 407.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-71",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1e7",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 450.0, 407.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-72",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "214",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 395.0, 407.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-73",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1fd",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 338.0, 407.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-74",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "20b",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 283.0, 407.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-75",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl mth 13",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 685.0, 329.0, 58.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-64",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1e9",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 676.0, 360.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-65",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl mth 12",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 626.0, 328.0, 58.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-66",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1f0",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 617.0, 360.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-67",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl mth 9",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 571.0, 329.0, 51.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-60",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1f8",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 562.0, 361.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-61",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl mth 8",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 516.0, 329.0, 51.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-62",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1ed",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 507.0, 361.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-63",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl mth 5",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 459.0, 329.0, 51.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-56",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1f7",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 450.0, 361.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-57",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl mth 4",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 404.0, 329.0, 51.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-58",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1f3",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 395.0, 361.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-59",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl mth 1",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 347.0, 329.0, 51.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-54",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "1d2",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 338.0, 361.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-55",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 262.0, 249.727234, 20.0, 20.0 ],
"outlettype" : [ "bang" ],
"id" : "obj-53"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl mth 0",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 292.0, 329.0, 51.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-52",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "207",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 283.0, 361.0, 27.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-44",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "207 1d2 2 1",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 296.0, 280.0, 518.5, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-17",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "zl filter brain",
"numinlets" : 2,
"numoutlets" : 2,
"patching_rect" : [ 292.0, 248.0, 73.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "", "" ],
"id" : "obj-16",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "sprintf %s%s",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 291.0, 220.0, 78.0, 20.0 ],
"fontsize" : 11.595187,
"outlettype" : [ "" ],
"id" : "obj-32",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print bang",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 14.0, 289.0, 53.0, 17.0 ],
"fontsize" : 9.0,
"id" : "obj-10",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "OpenSoundControl",
"numinlets" : 0,
"numoutlets" : 3,
"patching_rect" : [ 14.0, 260.0, 88.0, 17.0 ],
"fontsize" : 9.0,
"outlettype" : [ "", "", "" ],
"id" : "obj-1",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print messages",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 49.0, 308.0, 75.0, 17.0 ],
"fontsize" : 9.0,
"id" : "obj-2",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print time-tag",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 83.0, 289.0, 72.0, 17.0 ],
"fontsize" : 9.0,
"id" : "obj-3",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "p cnmat_compatibility",
"numinlets" : 0,
"numoutlets" : 0,
"patching_rect" : [ 188.0, 37.0, 109.0, 17.0 ],
"fontsize" : 9.0,
"id" : "obj-5",
"fontname" : "Arial",
"patcher" : {
"fileversion" : 1,
"rect" : [ 1582.0, 205.0, 385.0, 293.0 ],
"bglocked" : 0,
"defrect" : [ 1582.0, 205.0, 385.0, 293.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"metadata" : [ ],
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "udpreceive 7374 CNMAT",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 43.0, 142.0, 121.0, 17.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-1",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "Both udpsend and udpreceive support the ‘FullPacket’ message used by the CNMAT OpenSoundControl external. This means they can be used as drop in replacements for the [otudp] object.",
"linecount" : 3,
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 21.0, 27.0, 299.0, 38.0 ],
"fontsize" : 9.0,
"id" : "obj-2",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "Although udpsend and udpreceive use OSC as their transport protocol, the OpenSoundControl object by CNMAT has more robust support for OpenSoundControl as a protocol including bundling of multiple OSC messages, string substitution, time stamping etc. udpsend and udpreceive support a simple subset of OSC.",
"linecount" : 5,
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 20.0, 173.0, 296.0, 58.0 ],
"fontsize" : 9.0,
"id" : "obj-3",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "udpsend will respond to the ‘FullPacket’ message as expected. However, for udpreceive to know that it should pass on udp buffers as ‘FullPacket’ messages instead of decoding them itself you need to instantiate it with an optional third argument.",
"linecount" : 4,
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 22.0, 70.0, 261.0, 48.0 ],
"fontsize" : 9.0,
"id" : "obj-4",
"fontname" : "Arial"
}

}
],
"lines" : [ ]
}
,
"saved_object_attributes" : {
"default_fontsize" : 12.0,
"fontface" : 0,
"fontsize" : 12.0,
"default_fontface" : 0,
"globalpatchername" : "",
"fontname" : "Arial",
"default_fontname" : "Arial"
}

}

}
, {
"box" : {
"maxclass" : "message",
"text" : "maxqueuesize 512",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 9.0, 73.0, 86.0, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-6",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "print receivedmess",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 81.0, 227.0, 95.0, 17.0 ],
"fontsize" : 9.0,
"id" : "obj-12",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "set local port to listen for messages on",
"linecount" : 2,
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 188.0, 96.0, 131.0, 27.0 ],
"fontsize" : 9.0,
"id" : "obj-13",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "port 7005",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 128.0, 114.0, 56.0, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-14",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "message",
"text" : "port 7401",
"numinlets" : 2,
"numoutlets" : 1,
"patching_rect" : [ 120.0, 94.0, 55.0, 15.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-15",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "newobj",
"text" : "udpreceive 7005",
"numinlets" : 1,
"numoutlets" : 1,
"patching_rect" : [ 83.0, 143.0, 86.0, 17.0 ],
"fontsize" : 9.0,
"outlettype" : [ "" ],
"id" : "obj-24",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "udpsend & udpreceive",
"numinlets" : 1,
"frgb" : [ 0.082353, 0.219608, 0.035294, 1.0 ],
"numoutlets" : 0,
"patching_rect" : [ 5.0, 5.0, 212.0, 27.0 ],
"fontsize" : 18.0,
"textcolor" : [ 0.082353, 0.219608, 0.035294, 1.0 ],
"id" : "obj-25",
"fontname" : "Arial"
}

}
, {
"box" : {
"maxclass" : "comment",
"text" : "argument is port",
"numinlets" : 1,
"numoutlets" : 0,
"patching_rect" : [ 176.0, 144.0, 100.0, 17.0 ],
"fontsize" : 9.0,
"id" : "obj-33",
"fontname" : "Arial"
}

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

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

}
, {
"patchline" : {
"source" : [ "obj-74", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ 129.5, 139.0, 92.5, 139.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ 137.5, 139.0, 92.5, 139.0 ]
}

}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ 18.5, 139.0, 92.5, 139.0 ]
}

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

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

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

}
, {
"patchline" : {
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-32", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-32", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-32", 0 ],
"destination" : [ "obj-53", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-53", 0 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-52", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-54", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-58", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-56", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-62", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-60", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-66", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-64", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-44", 0 ],
"destination" : [ "obj-75", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
, {
"patchline" : {
"source" : [ "obj-55", 0 ],
"destination" : [ "obj-74", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

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

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

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

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

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

}
, {
"patchline" : {
"source" : [ "obj-65", 0 ],
"destination" : [ "obj-68", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}

}
]
}

}


September 3, 2008 | 3:12 pm

Hello krisztian,

To display HEX in a numerbox create a number box (not a floatnumber box), then open its attribute (select+ command+i) then choose HEX as the "display format"

That’s what you did with one of your number boxes (the middle one)

but as you wrote you can’t sent Hex to a number box, you got "number doesn’t understand f7" error.
Why?

because numberbox understand integer or float only.
The Hex option is only for display, if you patch two numberboxes with HEX option it looks like you pass HEX data from one to another but in fact it is integers that are converted at the end for display.

So you have at least 2 options:

use some messageboxes (right inlet)
or
convert Hex to integer before sending to numberbox

it depends on what you really need, display only or enter value or else

I hope this is clear :-)

olivier


September 3, 2008 | 4:21 pm

Hi Olivier,

My intention is to get the raw eeg data and put it through an fft, so I can be able to see whether the alfa or beta waves are more prominent while I am measuring brainwaves.
For that I have to get the equivalent of the hex data (which I only could display in a message box) in a number box. From there I can use the instructions of the designer of the device I received, which is the following:

//
each data is 10 bit : 000 .. 3ff (hex)

10 bit : 000.. 3ff

000 is 0V input. -> -2.5 V AD input ( – 100 micro V brain wave input )
200 is 2.5V input. -> 0 V AD input( 0 micro V brain wave input )
3ff is 5V input. -> +2.5 V AD input ( + 100 micro V brain wave input )

10 bit mean 1024 resolution from +-100 micro V brain wave input. ( 200 micro V full scale )
1 resolution is 0.1953125 0 micro V ( 200 micro V / 1024 )

//

But yet I still could not find a way to ‘enter the values’ a number box.

I hope this helps,
any ideas appreciated!

best,
Krisztian


September 3, 2008 | 5:44 pm

On Sep 3, 2008, at 7:40 AM, tedor wrote:

> But I got stuck as I do not know how the get the hex data into a
> numberbox!

Here’s a brute force, inelegant, way to convert hex symbols to integers:

– Pasted Max Patch, click to expand. –

Chris Muir
cbm@well.com

http://www.xfade.com


September 3, 2008 | 6:23 pm

I made this litlle two ways converter for Hex/integer

– Pasted Max Patch, click to expand. –

September 3, 2008 | 6:24 pm

Chris,

thank you, this needs to be hidden in a subpatch:)

all the best,
Krisztian


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