XML Feeds

.

[javascript-dev] Tasks and String manipulations

Garth Paine ga.paine at uws.edu.au
Sun Mar 16 07:24:31 MDT 2008


Thanks Volker

Yes indeed I am doing it that way at the moment, but I wanted to try it in
JavaScript hence my clumsy attempts - I don't get to do much coding these
days and try to give myself the odd challenge - also I don't generally see
Max as good at iterative things although in this case you are right it is
quite straight forward - this is my MAX solution which works fine, but any
suggestions re my JavaScript version would be welcome

max v2;
#N vpatcher 150 138 449 597;
#P inlet 28 68 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 151 406 116 196617 print BioDataSimulation;
#P newex 110 377 51 196617 zl slice 2;
#P window setfont "Sans Serif" 18.;
#P number 152 97 50 18 0 0 64 3 0 0 0 26 188 36 222 222 222 0 0 0;
#P outlet 109 408 15 0;
#P inlet 74 24 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 111 130 52 196617 metro 20;
#P toggle 111 28 52 0;
#P message 210 109 14 196617 0;
#P button 210 90 15 0;
#N counter;
#X flags 0 0;
#P newobj 110 153 66 196617 counter;
#P newex 111 334 34 196617 Text;
#B color 5;
#P message 51 257 37 196617 write;
#P window setfont "Sans Serif" 12.;
#P message 40 185 37 196620 read;
#B color 14;
#P window setfont "Sans Serif" 9.;
#P comment 49 207 52 196617 File I/O:;
#P message 44 307 35 196617 clear;
#P comment 43 290 48 196617 Erase all;
#P number 123 252 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 3;
#P comment 174 310 68 196617 double-click to see the text collected;
#P window setfont "Sans Serif" 20.;
#P number 110 174 110 20 0 0 0 3 0 0 0 74 156 97 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 111 208 45 196617 line \$1;
#P message 23 232 28 196617 open;
#P comment 69 233 150 196617 Display the text editing window;
#P fasten 20 1 18 0 156 402 114 402;
#P connect 16 0 12 0;
#P connect 12 0 3 0;
#P connect 11 0 20 0;
#P connect 17 0 15 0;
#P connect 15 0 16 0;
#P connect 3 0 2 0;
#P fasten 22 0 11 0 33 229 116 229;
#P fasten 1 0 11 0 28 316 28 316 28 328 116 328;
#P fasten 5 0 11 0 128 284 116 284;
#P fasten 7 0 11 0 49 326 116 326;
#P fasten 9 0 11 0 45 226 116 226;
#P fasten 10 0 11 0 56 285 116 285;
#P connect 2 0 11 0;
#P connect 20 1 21 0;
#P connect 14 0 12 3;
#P connect 19 0 16 1;
#P connect 15 0 13 0;
#P connect 13 0 14 0;
#P pop;


Cheers

Garth


On 14/03/08 10:26 PM, "volker böhm" <vboehm at gmx.ch> wrote:

> 
> On 14 Mar 2008, at 11:24, Garth Paine wrote:
>> 
>> I am reading out of a text file recorded using the Max Text object
>> so it
>> looks like
>> 
>> 0, 110 9 220 218;
>> 1, 110 9 218 218;
>> 2, 110 9 218 218;
>> 3, 110 9 218 218;
>> 4, 110 9 218 218;
>> 5, 110 14 218 218;
>> 6, 110 9 218 216;
>> 7, 110 9 218 220;
>> 8, 110 4 220 220;
>> 9, 110 4 220 220;
>> 10, 110 4 220 220;
>> 
>> 
>> I want to isolate each incoming integer and send it out a different
>> output
>> 
>> I looked at using regular expressions
>> 
>> re = /\(?\d{4}\)?([,])\d{2}\1\d{2}\1\d{2}\1\d{2}/;
> 
> 
> maybe i miss your point here. but if your data files look like this
> (coll format), it's much easier doing it in max using the coll
> object, a counter and a cycle object. trying to look at the text
> lines as strings in javascript and squeezing out the integers is more
> complex than it has to be in this case, imo. the format parsing is
> done by the coll object.
> 
> you could try something like this:
> 
> #P window setfont "Sans Serif" 9.;
> #P number 356 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 320 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 284 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 248 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 212 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 176 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 140 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P number 104 224 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 104 195 265 196617 cycle 8 1;
> #P toggle 104 75 19 0;
> #N counter 0 10;
> #X flags 0 0;
> #P newobj 104 137 68 196617 counter 0 10;
> #P newex 104 101 58 196617 metro 200;
> #N coll ;
> #T flags 1 0;
> #T 0 110 9 220 218;
> #T 1 110 9 218 218;
> #T 2 110 9 218 218;
> #T 3 110 9 218 218;
> #T 4 110 9 218 218;
> #T 5 110 14 218 218;
> #T 6 110 9 218 216;
> #T 7 110 9 218 220;
> #T 8 110 4 220 220;
> #T 9 110 4 220 220;
> #T 10 110 4 220 220;
> #P newobj 104 165 53 196617 coll;
> #P connect 1 0 2 0;
> #P connect 3 0 1 0;
> #P connect 0 0 4 0;
> #P connect 2 0 0 0;
> #P connect 4 0 5 0;
> #P connect 4 1 6 0;
> #P connect 4 2 7 0;
> #P connect 4 3 8 0;
> #P connect 4 4 9 0;
> #P connect 4 5 10 0;
> #P connect 4 6 11 0;
> #P connect 4 7 12 0;
> #P window clipboard copycount 13;
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> javascript-dev mailing list
> javascript-dev at cycling74.com
> http://www.cycling74.com/mailman/listinfo/javascript-dev

---
Kind Regards

Dr Garth Paine 
I implement the 5 sentences policy http://five.sentenc.es/

http://www.activatedspace.com
http://www.syncsonics.com
http://www.meterosonics.com
http://marcs.uws.edu.au/people/paine/

Senior Lecturer in Music Technology
School of Communication Arts
University of Western Sydney,
BD 1.14 Werrington South, Locked Bag 1797
Penrith South DC, NSW, 1797, Australia

http://marcs.uws.edu.au/people/paine/index.htm
Member of MARCS Auditory Laboratories
Coordinator VIPRE Research Lab
University of Western Sydney
Bankstown Campus
Webpage: <http://marcs.uws.edu.au/people/paine/>

MARCS Ph. +61 (0)2 9772 6902       FAX +61 (0)2 9772 6040



***************************************************************
Please do not forward this message to any other person or entity not named
in the recipient fields above without the express consent of the sender.  If
you are not the intended recipient of this message as set out in the address
field above, please contact the School of Communication Arts on +61 2 9852
5476 to advise.  Please remove the message from your system and do not
forward the message to any other person or entity.  The views expressed
herein are not necessarily those of the University of Western Sydney.

***************************************************************





More information about the javascript-dev mailing list