Forums > MaxMSP

RE – Construction of Message


ATH
January 31, 2008 | 2:26 pm

Hi,
I get from the serial object a stream of numbers:
This should lead back to Messages of the form:
"A 123 !"
"A 12 !"
etc.
How do I do this?

actual stream coming out of serial – object:
print: 33
print: 13
print: 10
print: 65
print: 32
print: 51
print: 55
print: 50
print: 32
print: 33
print: 13
print: 10
print: 65
print: 32
print: 51
print: 53
print: 57
print: 32
print: 33
print: 13
print: 10
print: 65
print: 32
print: 51
print: 53
print: 52
print: 32
print: 33
print: 13
print: 10
print: 65
print: 32
print: 51
print: 55
print: 49
print: 32
print: 33
print: 13
print: 10
print: 65
print: 32
print: 51
print: 54
print: 56
print: 32
Thanks for support


January 31, 2008 | 3:13 pm

The stream you get are ASCII char:
65 is ‘A’
32 is ‘ ‘
51 is ’3′
55 is ’7′
50 is ’2′
32 is ‘ ‘
33 is ‘!’

10 and 13 are lf/cr

So you have to convert this stream using something like [serial] ->
[sel 10 13] -> [zl group 66] -> [itoa] -> …

Good luck

p

On 31 janv. 08, at 15:26, ATH wrote:

>
> Hi,
> I get from the serial object a stream of numbers:
> This should lead back to Messages of the form:
> "A 123 !"
> "A 12 !"
> etc.
> How do I do this?
>
> actual stream coming out of serial – object:
> print: 33
> print: 13
> print: 10
> print: 65
> print: 32
> print: 51
> print: 55
> print: 50
> print: 32

> _____________________________

Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl

http://www.crfmw.be/max



ATH
January 31, 2008 | 6:21 pm

Thanks very much.
why zlgroup 66? Is the serial interface by definition sending packages of 66 bytes?
kind regards


January 31, 2008 | 7:26 pm


January 31, 2008 | 9:59 pm

On 31 janv. 08, at 20:26, Patrick Delges wrote:

> But I just discovered that you don’t have to put an argument, so [zl
> group] should work too (but in case you never send it a bang, it
> will never output anything).

It’s not totally true. The default value is 256, so when you don’t
provide the argument to zl, it waits for 256 elements to send the list
to the output.

ej

#P button 74 79 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 114 209 34 196617 zl len;
#P newex 114 239 32 196617 print;
#P newex 140 183 60 196617 print group;
#P newex 114 149 46 196617 zl group;
#P newex 74 111 50 196617 uzi 1000;
#P connect 1 0 4 0;
#P connect 1 0 2 0;
#P connect 5 0 0 0;
#P connect 4 0 3 0;
#P connect 0 2 1 0;
#P window clipboard copycount 6;


February 1, 2008 | 8:17 am



ATH
February 1, 2008 | 9:46 am

Thanks, this was a revelation. What made it complicated for me was: I didn’t know, and it isnt well documented in the help, that zlgroup truncates the stream when receiving a bang, even if not all of the 66 (or whatever) ascii-codes have passed.

kind regards


February 1, 2008 | 10:37 am


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