Format coll for line~

    Jan 24 2013 | 6:29 pm
    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;

    • Jan 24 2013 | 7:08 pm
      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;
    • Jan 24 2013 | 7:32 pm
      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.
    • Jan 24 2013 | 8:23 pm
      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".
    • Jan 24 2013 | 8:28 pm
      See also:
    • Jan 24 2013 | 9:09 pm
      Thanks for your help.
    • Jan 24 2013 | 10:46 pm
      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.
    • Jan 25 2013 | 12:35 am
      1) 0 seems to work for me:
      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.
    • Jan 27 2013 | 3:10 pm
      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?
    • Jan 28 2013 | 12:40 am
      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:
    • Jan 29 2013 | 12:41 am
      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.
    • Jan 29 2013 | 2:58 am
      I made this to illustrate ways to work around the comma for another thread:
    • Jan 29 2013 | 12:28 pm
      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.