Hi Arda

On Fri, 2019-04-05 at 16:00 +0300, Arda Eden wrote:
> 
> I am reading the udp data with [netreceive] succesfully and able to
> reach any value I need.  Now trying to find a way to combine these
> (big endian) sequential 4 bytes in order to get the resulting 32 bit
> floating point number. A little advice would speed me up.


Don't know if you need to do it in your own external. If you do the
message parsing in Pd (as opposed to a dedicated external), check
attached patch. It converts between floats and 4-byte-lists. Probably
not efficient, when converting tons of numbers, but easy if you're
looking for a quick'n'dirty solution.

Roman
#N canvas 119 99 443 367 10;
#N canvas 0 99 387 150 float2bytes 0;
#X obj 34 64 oscformat l;
#X obj 34 87 list split 8;
#X obj 34 38 inlet;
#X obj 68 120 outlet;
#X connect 0 0 1 0;
#X connect 1 1 3 0;
#X connect 2 0 0 0;
#X restore 109 97 pd float2bytes;
#N canvas 0 99 409 269 bytes2float 0;
#X msg 102 90 47 108 0 0 44 102 0 0;
#X obj 33 133 list prepend;
#X obj 102 59 loadbang;
#X obj 33 156 oscparse;
#X obj 33 179 list trim;
#X obj 33 202 route l;
#X obj 33 32 inlet;
#X obj 33 227 outlet;
#X connect 0 0 1 1;
#X connect 1 0 3 0;
#X connect 2 0 0 0;
#X connect 3 0 4 0;
#X connect 4 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 1 0;
#X restore 109 215 pd bytes2float;
#X obj 109 138 t a a;
#X obj 136 165 print BYTES;
#X obj 109 300 print FLOAT;
#X floatatom 109 32 10 0 0 0 - - -;
#X connect 0 0 2 0;
#X connect 1 0 4 0;
#X connect 2 0 1 0;
#X connect 2 1 3 0;
#X connect 5 0 0 0;

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

Reply via email to