Format coll for line~

Jan 24, 2013 at 6:29pm

Format coll for line~

How can I format coll indices so I can drive a line~?

For example, if I use the format for a line~ message, coll will not recognize this if I input it this way.

1, 0, 1 2000 0 2000;

#66208
Jan 24, 2013 at 7:08pm

You don’t really have to do that. A comma in a message box separates the contents into discrete messages. So “0, 1 2000 0 2000″ sends the message “0″ then immediately sends the message “1 2000 0 2000″.

So, you could either use two separate indices:
0, 0;
1, 1 2000 0 2000;

or go to 0 immediately in one:
1, 0 0 1 2000 0 2000;

#238324
Jan 24, 2013 at 7:32pm

I am not sure whether line~ would accept 1, 0 0 1 2000 0 2000;. I need these to drive an FM synth. I preferably would like to be able to use this data to clear and reset a function object but can’t figure that one out (posted in another post). I did find this example that seems to do the trick.

– Pasted Max Patch, click to expand. –
#238325
Jan 24, 2013 at 8:23pm

I was giving you what to put in a coll. If the line in coll reads “1, 0 0 1 2000 0 2000;” then the output is “0 0 1 2000 0 2000″.

#238326
Jan 24, 2013 at 8:28pm

See also:
http://cycling74.com/forums/topic.php?id=44199
http://cycling74.com/forums/topic.php?id=14499
&c.

and:

– Pasted Max Patch, click to expand. –
#238327
Jan 24, 2013 at 9:09pm

Thanks for your help.

#238328
Jan 24, 2013 at 10:46pm

Hi,
it seems that coll does not accept a 0 (or integers ) as a first element of a list, when followed by comma. (maybe I am wrong).
With line~ we need sometimes to go to 0 first, in deed. To bypass this, here a solution; there are for shure more elegant ways.

– Pasted Max Patch, click to expand. –

Best

#238329
Jan 25, 2013 at 12:35am

1) 0 seems to work for me:

– Pasted Max Patch, click to expand. –

2) This whole comma thing is unnecessary, for reasons mentioned above. I try to avoid sprintf whenever possible (which is not always), generating symbols is not very cpu or memory efficient.

#238330
Jan 27, 2013 at 3:10pm

These are interesting examples. I am not familiar with your formatting mzed for the coll though. What is the purpose of the backslash? Can you dissect it for me?

#238331
Jan 28, 2013 at 12:40am

Comma is a character that has special meaning in max. Either in a message box (where it divides two messages) or in a coll (where it separates the index from the data) it is treated differently than regular ascii characters. In order for the comma to pass through these objects without the special treatment, it is “escaped”. In this case, it is escaped by putting a backslash in front of it. Backslash is also a special character, and it means “treat the next character as a normal ascii character”.

Escaping with backslash is not an uncommon convention in text-based programming languages:

http://en.wikipedia.org/wiki/Escape_character

#238332
Jan 29, 2013 at 12:41am

I’m guessing these are line~ values generated from function? I highly recommend the “list” output mode option for function, and personally treat “normal” mode as deprecated since it also introduces more inconsistencies in timing.

I also recommend zl.slice and zl.lace/delace can also be useful for manipulating these sorts of lists.

#238333
Jan 29, 2013 at 2:58am

I made this to illustrate ways to work around the comma for another thread:

– Pasted Max Patch, click to expand. –
#238334
Jan 29, 2013 at 12:28pm

Thanks mzed. That makes sense. I was not aware of that.

Peter, I would like to use function but the problem I am running into is clearing function so I can then send new values to it. I have another post up about it but no one has responded to it. Perhaps you have an idea as how to do that.

Thanks, Chris. Interesting solutions. Love that max is flexible in this way that you can solve a problem multiple ways.

#238335

You must be logged in to reply to this topic.