coll using floats; text making columns

Nov 26, 2008 at 12:14am

coll using floats; text making columns

Hello,
I’m having trouble collecting data in the format that I want.
Essentially, I’d like a collection of 2-element rows where the first element is time [in ms], and the second is a chord [midi number, though the symbol version would be better].

In the left part of the patch, I can get time in ms, but it’s one long array. Is there a way to make rows?

In the right part of the patch, I cannot get coll to print time in ms, I get an error. Is there a way to fix this?

For both, is there a way to print the chord name rather than its MIDI number equivalent?

Many thanks!

max v2;
#N vpatcher 894 44 1542 691;
#P origin 0 11;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 409 115 57 196617 0.02322;
#P button 261 183 15 0;
#P newex 261 215 72 196617 t 0 clear set;
#P comment 277 183 29 196617 reset;
#P button 313 243 15 0;
#P newex 340 243 62 196617 prepend set;
#P window linecount 0;
#P message 340 271 138 196617;
#P window linecount 1;
#P newex 340 215 48 196617 pack 0 0;
#P flonum 340 185 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 426 136 37 196617 metro;
#P number 426 183 35 9 0 128 4099 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 426 158 64 196617 random 128;
#P toggle 378 113 15 0;
#P button 378 93 15 0;
#P message 378 67 27 196617 stop;
#P message 310 67 65 196617 startwindow;
#P newex 340 159 55 196617 * 0.001;
#P newex 340 135 43 196617 clocker;
#P message 161 112 43 196617 0.02322;
#P button 13 180 15 0;
#P newex 13 212 72 196617 t 0 clear set;
#P comment 29 180 29 196617 reset;
#P newex 92 327 40 196617 text;
#P objectname test1[1];
#P button 65 240 15 0;
#P newex 341 300 71 196617 t writeagain l;
#N coll results;
#P newobj 341 338 61 196617 coll results;
#P newex 92 240 62 196617 prepend set;
#P window linecount 0;
#P message 92 268 138 196617;
#P window linecount 1;
#P newex 92 212 54 196617 pack 0. 0;
#P newex 92 296 121 196617 sprintf %f\\\, %ld\\\;;
#P flonum 92 182 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 178 133 37 196617 metro;
#P number 178 180 35 9 0 128 4099 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 178 155 64 196617 random 128;
#P toggle 130 110 15 0;
#P button 130 90 15 0;
#P message 130 64 27 196617 stop;
#P message 62 64 65 196617 startwindow;
#P newex 92 156 55 196617 * 0.001;
#P newex 92 132 43 196617 clocker;
#P user ftm.object 181 21 63 18 3 9 –> 0;
#T _#ftm version 2 3;
#T _#scope begin;
#T _#absargs $0_ $1_ $2_ $3_ $4_ $5_ $6_ $7_ $8_ $9_;
#T _#def 0 “_($N / $sr)” t_ms local;
#P user ftm.object 69 21 87 18 3 9 –> 0;
#T _#def 0 _($FTM.audio.sr) sr local;
#P user ftm.object 14 21 39 18 3 9 –> 0;
#T _#def 0 _1024 N local;
#T _#scope end;
#P window linecount 2;
#P comment 35 400 100 196617 How can I get this to produce rows?;
#P window linecount 3;
#P comment 318 394 212 196617 Coll won’t let me use floats. Can I change that? If you change the first element in pack to ’0.’ rather than ’0′ you’ll see what I mean.;
#P window linecount 1;
#P comment 101 483 393 196617 How can I get the chord symbol to print … rather than it’s MIDI number equivalent?;
#P connect 26 0 25 0;
#P connect 17 0 22 0;
#P connect 11 0 6 0;
#P connect 6 0 7 0;
#P connect 7 0 15 0;
#P connect 15 0 17 0;
#P connect 17 0 19 0;
#P connect 25 2 18 0;
#P connect 22 0 18 0;
#P connect 19 0 18 0;
#P connect 18 0 16 0;
#P connect 16 0 23 0;
#P connect 25 1 23 0;
#P connect 27 0 6 1;
#P connect 9 0 10 0;
#P connect 8 0 10 0;
#P connect 10 0 11 0;
#P connect 13 0 17 1;
#P connect 11 0 14 0;
#P connect 14 0 12 0;
#P connect 12 0 13 0;
#P connect 27 0 14 1;
#P connect 44 0 43 0;
#P connect 38 0 41 0;
#P connect 33 0 28 0;
#P connect 28 0 29 0;
#P connect 29 0 37 0;
#P connect 37 0 38 0;
#P connect 38 0 40 0;
#P connect 40 0 39 0;
#P connect 41 0 39 0;
#P connect 43 2 39 0;
#P connect 39 0 21 0;
#P connect 43 1 20 0;
#P connect 21 1 20 0;
#P connect 21 0 20 0;
#P connect 45 0 28 1;
#P connect 30 0 32 0;
#P connect 31 0 32 0;
#P connect 32 0 33 0;
#P connect 35 0 38 1;
#P connect 33 0 36 0;
#P connect 36 0 34 0;
#P connect 34 0 35 0;
#P connect 45 0 36 1;
#P pop;

#41053
Nov 26, 2008 at 1:14am

Here’s an abstraction for turning integers into MIDI note names. As for your other problem, saving the time and note data separately in columns would be pretty easy, just insert a line break after inputting every pair of values using [trigger]. If you need rows you might want to look at [zl group] which will store a certain number of values in to a list. Or storing the time and note data in two seperate [coll]s and then sending the contents of each as one long message to the [text] object whenever suits you.

lh

#P outlet 85 192 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 255 110 21 196617 t ?;
#P newex 207 150 27 196617 – 2;
#P newex 207 130 31 196617 / 12;
#P newex 85 170 132 196617 sprintf %s%s;
#N coll unique_name_itonn;
#T flags 1 0;
#T 0 C;
#T 1 C#;
#T 2 D;
#T 3 D#;
#T 4 E;
#T 5 F;
#T 6 F#;
#T 7 G;
#T 8 G#;
#T 9 A;
#T 10 A#;
#T 11 B;
#P newobj 85 150 114 196617 coll unique_name_itonn;
#P newex 85 130 34 196617 % 12;
#P newex 85 110 132 196617 t i i;
#P newex 85 90 180 196617 split 0 127;
#P inlet 85 72 15 0;
#P fasten 8 0 9 0 260 189 90 189;
#P connect 5 0 9 0;
#P connect 0 0 1 0;
#P connect 1 1 8 0;
#P connect 7 0 5 1;
#P connect 6 0 7 0;
#P connect 2 1 6 0;
#P connect 4 0 5 0;
#P connect 3 0 4 0;
#P connect 2 0 3 0;
#P connect 1 0 2 0;
#P window clipboard copycount 10;

#145807

You must be logged in to reply to this topic.