Forums > MaxMSP

Swapping #s In A List

April 1, 2008 | 6:36 pm

I have a list of numbers:

12345

I need max to swap the first and second as well as the third and fourth numbers, then swap the second and third and the fourth and fifth. Like so:

12345
changes to
21435
which then changes to
25153

and so on…

It’s a pretty basic question, but I am new to the program and would take any advice possible. I need Max to cycle through these changes until it recreates the original list.

Any help?

Thanks,

joseph



MIB
April 1, 2008 | 10:41 pm

this should do the trick… but you need the checklist object from here: http://www.jasch.ch/dl/default.htm in order to know when you are back to the original list.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 348 324 33 196617 clear;
#P newex 95 200 40 196617 t l b l;
#P newex 95 102 40 196617 t l b l;
#P newex 95 73 75 196617 pack 0 0 0 0 0;
#P newex 291 389 186 196617 pack 1 0 0 0 0 0;
#N counter;
#X flags 0 0;
#P newobj 291 364 66 196617 counter;
#N coll ;
#P newobj 291 411 53 196617 coll;
#P newex 95 289 53 196617 t l l b l;
#P message 124 430 14 196617 1;
#P message 109 430 14 196617 0;
#P newex 109 387 41 196617 sel 1 0;
#P newex 58 329 47 196617 gate 1 1;
#P newex 109 362 140 196617 checklist;
#P newex 95 267 75 196617 pack 0 0 0 0 0;
#P newex 95 227 85 196617 unpack 0 0 0 0 0;
#P newex 95 156 33 196617 swap;
#P newex 95 180 75 196617 pack 0 0 0 0 0;
#P message 95 41 52 196617 1 4 3 4 5;
#P newex 95 133 85 196617 unpack 0 0 0 0 0;
#P connect 8 0 9 0;
#P fasten 8 0 13 2 114 408 485 408 485 356 324 356;
#P connect 1 0 15 0;
#P fasten 1 0 6 1 100 62 244 62;
#P connect 14 0 12 0;
#P connect 13 0 14 0;
#P fasten 16 2 14 1 130 128 331 128;
#P fasten 17 2 14 1 130 222 331 222;
#P fasten 11 3 14 1 142 316 331 316;
#P connect 18 0 12 0;
#P connect 6 0 8 0;
#P fasten 11 2 13 0 128 319 296 319;
#P connect 5 0 11 0;
#P fasten 11 1 6 0 114 353 114 353;
#P connect 11 0 7 1;
#P connect 17 0 4 0;
#P fasten 17 1 13 0 115 225 296 225;
#P connect 2 0 17 0;
#P connect 16 0 0 0;
#P fasten 16 1 13 0 115 130 296 130;
#P connect 15 0 16 0;
#P fasten 7 0 15 0 63 350 31 350 31 67 100 67;
#P fasten 10 0 7 0 129 454 40 454 40 322 63 322;
#P fasten 9 0 7 0 114 449 45 449 45 326 63 326;
#P connect 8 1 10 0;
#P connect 0 4 2 4;
#P connect 0 3 2 2;
#P connect 0 2 2 3;
#P connect 0 0 3 0;
#P connect 4 4 5 3;
#P connect 4 3 5 4;
#P connect 4 2 5 1;
#P connect 4 1 5 2;
#P connect 4 0 5 0;
#P connect 3 1 2 1;
#P connect 3 0 2 0;
#P connect 0 1 3 1;
#P window clipboard copycount 19;



MIB
April 1, 2008 | 10:55 pm

oops, don’t you love typos??? the initial list should say [1 2 3 4 5] not [1 4 3 4 5]… it’s easier to see the changes if you fix it.
cheers


April 1, 2008 | 11:03 pm

I don’t exactly understand the message. Are these instructions on how to make a patch? Was an image or table suppose to be displayed? I am wondering if my browser is acting funny or if I am just a tad bit inept.



MIB
April 1, 2008 | 11:17 pm

I made a mistake…
here is the corrected version… sorry

#P window setfont "Sans Serif" 9.;
#P number 237 431 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 348 324 33 196617 clear;
#P newex 95 200 40 196617 t l b l;
#P newex 95 102 40 196617 t l b l;
#P newex 95 73 75 196617 pack 0 0 0 0 0;
#P newex 291 389 186 196617 pack 1 0 0 0 0 0;
#N counter;
#X flags 0 0;
#P newobj 291 364 66 196617 counter;
#N coll ;
#P newobj 291 411 53 196617 coll;
#P newex 95 289 53 196617 t l l b l;
#P message 124 430 14 196617 1;
#P message 109 430 14 196617 0;
#P newex 109 387 41 196617 sel 1 0;
#P newex 58 329 47 196617 gate 1 1;
#P newex 109 362 140 196617 checklist;
#P newex 95 267 75 196617 pack 0 0 0 0 0;
#P newex 95 227 85 196617 unpack 0 0 0 0 0;
#P newex 95 156 33 196617 swap;
#P newex 95 180 75 196617 pack 0 0 0 0 0;
#P message 95 41 52 196617 1 2 3 4 5;
#P newex 95 133 85 196617 unpack 0 0 0 0 0;
#P comment 151 41 78 196617 click on the list;
#P window linecount 2;
#P comment 317 439 100 196617 double click on coll to get your results;
#P fasten 11 0 9 0 114 449 45 449 45 326 63 326;
#P fasten 12 0 9 0 129 454 40 454 40 322 63 322;
#P connect 3 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 2 0;
#P fasten 9 0 2 0 63 356 34 356 34 126 100 126;
#P connect 2 0 5 0;
#P connect 5 0 4 0;
#P connect 4 0 19 0;
#P connect 19 0 6 0;
#P connect 6 0 7 0;
#P connect 7 0 13 0;
#P connect 13 0 9 1;
#P fasten 13 1 8 0 114 353 114 353;
#P connect 8 0 10 0;
#P connect 10 0 11 0;
#P connect 5 1 4 1;
#P connect 6 2 7 1;
#P connect 2 1 5 1;
#P connect 10 1 12 0;
#P connect 2 3 4 2;
#P connect 6 1 7 2;
#P connect 2 2 4 3;
#P connect 6 4 7 3;
#P connect 2 4 4 4;
#P connect 6 3 7 4;
#P connect 15 0 21 0;
#P fasten 3 0 8 1 100 62 244 62;
#P fasten 18 1 15 0 115 130 296 130;
#P fasten 19 1 15 0 115 225 296 225;
#P fasten 13 2 15 0 128 319 296 319;
#P connect 15 0 16 0;
#P connect 20 0 14 0;
#P connect 16 0 14 0;
#P fasten 10 0 15 2 114 408 485 408 485 356 324 356;
#P fasten 13 3 16 1 142 316 331 316;
#P fasten 19 2 16 1 130 222 331 222;
#P fasten 18 2 16 1 130 128 331 128;
#P window clipboard copycount 22;

just highlight and copy the text from your browser and then past it into a new Max window.


April 2, 2008 | 10:18 am

copy all of those lines and paste them into your max patch.

On Apr 1, 2008, at 7:03 PM, Joseph wrote:
>
> I don’t exactly understand the message. Are these instructions on
> how to make a patch? Was an image or table suppose to be displayed?
> I am wondering if my browser is acting funny or if I am just a tad
> bit inept.


April 2, 2008 | 1:47 pm

There are a number of third-party objects built specially for facilitating cycling through permutations of lists.

Try typing ‘permutation’ into the search box at http://www.maxobjects.com.

There was, in particular, an object based on the English change-ringing tradition. As a fan of Dorothy L. Sayers I was particularly charmed by it. However I’m not sure it turned up at maxobjects, and I’ve forgotten the name.

If you’re not wanting to cycle but to choose random permutations, I can’t let the opportunity to plug lp.crabelms pass. It is a plug-and-play replacement for James McCarthy’s wonderful-but-orphaned scramble object. Part of the Litter Starter Pack.

– P.


April 2, 2008 | 2:23 pm

Peter’s objects are terrific (and probably what you want), but if you
feel like going totally insane with list-processing the grandma/pa of
them all is LISP:

http://music.columbia.edu/~brad/maxlispj/

brad

http://music.columbia.edu/~brad

On Apr 2, 2008, at 9:47 AM, Peter Castine wrote:

>
> There are a number of third-party objects built specially for
> facilitating cycling through permutations of lists.
>
> Try typing ‘permutation’ into the search box at http://
> http://www.maxobjects.com.
>
> There was, in particular, an object based on the English change-
> ringing tradition. As a fan of Dorothy L. Sayers I was particularly
> charmed by it. However I’m not sure it turned up at maxobjects, and
> I’ve forgotten the name.
>
> If you’re not wanting to cycle but to choose random permutations, I
> can’t let the opportunity to plug lp.crabelms pass. It is a plug-
> and-play replacement for James McCarthy’s wonderful-but-orphaned
> scramble object. Part of the Litter Starter Pack.
>
> — P.
>
>
> –
> —-
> Peter Castine
> Litter Power: < http://www.bek.no/~pcastine/Litter/>
> iCE Tools: <
http://www.dspaudio.com/software/ice/ice_overview.php>
>


April 2, 2008 | 2:27 pm

I actually needed this for my own Change Ringing patch. I’m in class now, but I’ll post my progress when I get a chance later today.



bdc
April 2, 2008 | 2:36 pm

The ‘change-ringing’ external was tintin by Kurt Ralske . You can find it in the maxobjects listings, but the link to the site is dead. The description there doesn’t reference change-ringing, but I’m quite sure that was the one. No UB or Windows versions, though.

Brad

—– Original Message —–
From: Peter Castine

Date: Wednesday, April 2, 2008 8:15 am
Subject: [maxmsp] Re: Swapping #s In A List

>
> There are a number of third-party objects built specially for
> facilitating cycling through permutations of lists.
>
> Try typing ‘permutation’ into the search box at
> http://www.maxobjects.com.
> There was, in particular, an object based on the English change-
> ringing tradition. As a fan of Dorothy L. Sayers I was
> particularly charmed by it. However I’m not sure it turned up at
> maxobjects, and I’ve forgotten the name.
>
> If you’re not wanting to cycle but to choose random
> permutations, I can’t let the opportunity to plug lp.crabelms
> pass. It is a plug-and-play replacement for James McCarthy’s
> wonderful-but-orphaned scramble object. Part of the Litter
> Starter Pack.
>
> — P.
>
>
> –
> —-
> Peter Castine
> Litter Power: < http://www.bek.no/~pcastine/Litter/>
> iCE Tools: <
http://www.dspaudio.com/software/ice/ice_overview.php>
>
>


Viewing 10 posts - 1 through 10 (of 10 total)