0

I'm new to Python and trying to send a list of floats from Max/MSP but all I receive is some encrypted jargon on the other side. For example if I tried to send

-64.463172 24.633138 10.054035 -2.445868 -7.855343 -8.22241 -7.066427 -5.288864 -2.530465 0.458666 2.289094 2.566208 1.953798 1.114607 0.296125 -0.339662 -0.604555 -0.518344 -0.328184 -0.239883 -0.265401 -0.312797 -0.300493 -0.189546

I receive

b'list\x00\x00\x00\x00,ffffffffffffffffffffffff\x00\x00\x00\xc2\x80\xed%A\xc5\x10\xabA \xddT\xc0\x1c\x89\x1a\xc0\xfb^\xf8\xc1\x03\x8e\xfe\x
c0\xe2 ,\xc0\xa9>_\xc0!\xf3%>\xea\xd6B@\x12\x80\x86@$<\xc1?\xfa\x16\x0f?\x8e\xabt>\x97\x9d\xc1\xbe\xad\xe8=\xbf\x1a\xc4\x1e\xbf\x04\xb2*\xb
e\xa8\x07\xc3\xbeu\xa3\xcb\xbe\x87\xe2\x96\xbe\xa0&\xe8\xbe\x99\xda.\xbeB\x18^'

A similar question was asked here
max/msp to ruby via udp message format
but that was dealing with integers and it was easy enough to parse and get the right number out, but I have no idea how to decode this. Any help?

JohnH
  • 2,713
  • 12
  • 21
to_the_sun
  • 63
  • 6
  • I've discovered that I'm dealing with raw bytes here. However, if I try to use decode() I get an error like this one `File "C:\Users\tothesun\AppData\Local\Programs\Python\Python35\lib\encodings\utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 38: invalid continuation byte` – to_the_sun May 27 '17 at 20:02

2 Answers2

1

I discovered that the object I was using ([udpsend]) uses the OSC protocol and that's what was responsible for all the excess encryption. I switched to [MXJ net.udp.send] and the numbers came through cleanly, except for being surrounded by apostrophes with a b in front. This apparently indicates that it's in bytes and can be removed with bytes.decode().

to_the_sun
  • 63
  • 6
0

The Sadam object library contains several flawlessly working UDP objects. As you said the OSC objects are not made for raw UDP communication.

schlank
  • 19
  • 4