Coll object removing double quotation marks in .txt file
I have a coll object which is reading a text file which is being used as a cue sheet to trigger various elements within the patch and also other software. The cue sheet text file (created externally) uses double quotation (" ") marks to encapsulate data, which is essential for another part of the patch to read strings of text as a single "column" value.
However, coll seems to be randomly excluding " " marks on some rows without any apparent logic or reason behind it. For example, the first 4 lines of the text file are:
1, "1" "Direct" "MasterINIT" "INIT" "Single" "Indirect1" "PPGRed" "5in" "4" "null" "TEST HAS THIS UPDATED MasterINIT will set all the dummy clips to the right level and trigger the first drone";
1001, "1" "null" "null" "null" "null" "null" "null" "null" "null" "A" "null";
1021, "1 1" "Direct Direct" "MultiphonicsImprov1 MultiphonicsImprov2" "5Out 5In" "Loop" "null" "null" "null" "null" "null" "null";
1033, "1 1" "Direct Direct" "MultiphonicsImprov2 MultiphonicsImprov3" "5Out 5In" "Loop" "null" "null" "null" "null" "null" "NB multiphonicImprov2 shouldnt retrigger it should only send a message to the dummy clip";
However, the coll file is converting it to:
1, 1 Direct MasterINIT INIT Single Indirect1 PPGRed 5in 4 null "MasterINIT will set all the dummy clips to the right level and trigger the first drone";
1001, 1 null null null null null null null null A null;
1021, "1 1" "Direct Direct" "MultiphonicsImprov1 MultiphonicsImprov2" "5Out 5In" Loop null null null null null null;
1033, "1 1" "Direct Direct" "MultiphonicsImprov2 MultiphonicsImprov3" "5Out 5In" Loop null null null null null "NB multiphonicImprov2 shouldnt retrigger it should only send a message to the dummy clip";
Is there a way to override the behaviour of coll so that it forces " " symbols on every value?
For context - I'm using the coll index to mirror bar numbers in a piece for instruments and live electronics where certain sound and DMX lighting elements need to be triggered on certain beats, but to ensure that the column schema is adhered to, I've included instances where two samples need to be triggered at the same time within the same 'cell' so they can be separated later on.
Thanks!
Can you substitute " with ' in preparing the txt file?
A.
However, coll seems to be randomly excluding " " marks on some rows without any apparent logic or reason behind it.
The "
are a special character in Max used to delimit single symbols containing a space. See that page in the doc for more precise information.
Your "
are removed for any data/column that is not a symbol containing a space. This happens because of the way you are loading your text file into Max and the way you treat its data. But without a look at your patch, it's difficult to point out the exact problem.
Also, depending on how you actually use these data, this might or might not be actually an issue, as each of your columns are still consistently defined, even with the removed "
. The only thing that looks a bit concerning is your "1"
being interpreted as 1
that definitely shows that you're doing unnecessary steps in you patch.
You can always escape the "
by doing \"null\"
so that the "
doesn't get interpreted as delimiters by Max but actual character, but I bet you don't probably need to do that, and it's usually bad practice because sometimes depending on your patch you even need to escape them multiple times, like \\\"null\\\"
which becomes unbearable.
Anyway, don't do that, and show us your patch for loading your data into coll and how you use them.
If I take the following text:
1, "1" "Direct" "MasterINIT" "INIT" "Single" "Indirect1" "PPGRed" "5in" "4" "null" "TEST HAS THIS UPDATED MasterINIT will set all the dummy clips to the right level and trigger the first drone";
1001, "1" "null" "null" "null" "null" "null" "null" "null" "null" "A" "null";
1021, "1 1" "Direct Direct" "MultiphonicsImprov1 MultiphonicsImprov2" "5Out 5In" "Loop" "null" "null" "null" "null" "null" "null";
1033, "1 1" "Direct Direct" "MultiphonicsImprov2 MultiphonicsImprov3" "5Out 5In" "Loop" "null" "null" "null" "null" "null" "NB multiphonicImprov2 shouldnt retrigger it should only send a message to the dummy clip";
and save it in a file that I read
directly into a [coll], the "
are properly kept for single-number elements and symbols with space. Only single-words symbols like "A"
or "null"
loose their "
, which again shouldn't be an issue in your patch logic.
And again, if you use single quotation marks ( ‘) instead of ( “) then it should work (at least here on my Mac it does work)
And again, if you use single quotation marks ( ‘) instead of ( “) then it should work (at least here on my Mac it does work)
Not a good idea as it might break some parts of the patch. "1 1"
is treated as one symbol by max (or one "column" in coll), while '1 1'
is treated as a list of two symbols (or two columns in coll): '1
and 1'
It can be a good solution in some circumstances but hard to say if it's the case for OP without knowing more.
no need to do anything here.
removed unneeded quotation marks will not break separation of single items and lists,
which are enclosed in quotation marks.
Thank you for all your replies! TFL and SA are both right, and thank you for the link to the message types help page - I'd not properly understood how symbols work in Max. Glad that it's not a strange bug with coll. The patch is behaving as it should, but as it's for a live performance I was slightly paranoid that something unintended would happen.
Out of curiosity - does Max handle 'null' messages in any unique ways when they appear as symbols? I'm still trying to wrap my head around Max as 'not-quite-a-coding-language, but not-quite-software', so it would be useful to know whether I should avoid using 'null' when creating data structures.
null
messages are regular symbols in Max. Special words you might want to avoid are the message names you can find in most objects in the Messages section of the Reference tab. You especially want to avoid list
, bang
, int
, float
and symbol
but again it depends on by which object these messages pass through.
Great, that's what I suspected. I hadn't seen 'null' used anywhere in Max so far.
TFL wrote:
"1 1"
is treated as one symbol by max (or one "column" in coll), while '1 1'
is treated as a list of two symbols (or two columns in coll): '1
and 1'
the mean thing is that it is sometimes true and sometimes not. in fact the left and right quote is the even older system in max, long before double quote and single quote/apostrophe did their job, and (still) works fine for [t ‘1 1’] and most other objects.
...which almost looks like [t '1 1'], but it isn't.
(i took the chance and used the correct apostrophe here, normally i don´t)
things like that is why i regulary tell new users to stay aways from the numberbox object... which does not really give you the whole picture... instead it somehow has its own strange syntax when it comes to quotes and $-sign arguments.