Forums > MaxMSP

break data into bytes and bits in max?


Jun 20 2013 | 3:45 pm

Hey all,

I’ve seen the atoi object, but I’m curious if there is an ascii->bytes or something along those lines in MAX.

Jun 20 2013 | 5:26 pm

Difficult to say without more details on what you are trying to accomplish.

But if you have formatted the data as bytes from wherever you are sending the data from then max will receive it in that format.

For example, the SARCduino firmware ( http://www.musicsensorsemotion.com/2010/03/08/sarcduino/ ) sends all data as bytes which are then parsed in Max.

All digital ports are read and their state is sent to max as 2 bytes (representing states for 12 inputs) which are then parsed in Max.

Analog inputs are also sent as 2 bytes (per input) and the values parsed in Max to get the corresponding 0-1023 values.

hope this helps

– Miguel

Jun 20 2013 | 6:18 pm

Very helpful, thank you! I would like to read a binary file, like a movie, and send it out as bytes. So read in a large file, and a byte at a time break it down and have 8 message boxes, each with a 1 or 0. This would happen once per second, let’s say. Very impractical, I know. Thoughts?

Jun 20 2013 | 6:50 pm

Haven’t done it myself but it sounds like you should have a look at the [filein] object.

Just tried it with a video file and seems to work although values are not 1 or 0. I’m sure if you try it out and ask in the forum for the specific object you might get better feedback from the community.

Hope it all works well.

– Miguel

Jun 20 2013 | 7:31 pm

this is one way you can convert decimal ints into binary bits

<code>
-- Pasted Max Patch, click to expand. --

</code>

Jun 21 2013 | 5:05 am

This is how I isolate bits within a byte, similar to Floating Point’s method.

— Pasted Max Patch, click to expand. —
Viewing 6 posts - 1 through 6 (of 6 total)

Forums > MaxMSP