Forums > MaxMSP

Object to take a list at input, send odd element #'s to one output,even element #'s to oth

January 26, 2007 | 4:56 am

I’m trying to find an object that can:

take a list at its input and, (assuming the list elements are indexed (1,2,3,4,…)

send odd index numbered elements to one output, and even index numbered elements to the other output.

Can anyone recommend an object or external, or combination thereof, that can do this?

Thanks, any help is appreciated


January 26, 2007 | 7:25 am

Max Planck wrote:
> I’m trying to find an object that can:
>
> take a list at its input and, (assuming the list elements are indexed
> (1,2,3,4,…)
>
> send odd index numbered elements to one output, and even index
> numbered elements to the other output.

There are a few useful concepts in the patch below, all of which are
worth knowing.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 58 196 27 9109513 + 1;
#P newex 58 234 34 9109513 gate 2;
#P newex 58 172 27 9109513 % 2;
#P newex 26 142 42 9109513 buddy 2;
#P newex 26 109 85 9109513 unpack 1 anything;
#P newex 82 262 50 9109513 print even;
#P newex 58 285 44 9109513 print odd;
#P message 26 51 60 9109513 a b c d e f g;
#P newex 26 79 46 9109513 listfunnel;
#P connect 7 1 3 0;
#P connect 7 0 2 0;
#P fasten 5 0 7 1 31 225 87 225;
#P connect 8 0 7 0;
#P connect 6 0 8 0;
#P connect 5 1 6 0;
#P connect 4 1 5 0;
#P connect 4 0 5 1;
#P connect 0 0 4 0;
#P connect 1 0 0 0;
#P window clipboard copycount 9;


January 26, 2007 | 12:49 pm

>Because the forum search is a shit. It never works,
for nothing, gives
>you only 2 answers where you know there are dozens…
It’ll never
>replace the old googling style for the old archives.

>f.e

Sadly this contains more than a grain of truth, and
is worth remembering when trying to help/ranting at
newbies.

Of course there is no excuse for not searching
manuals & .help files first, but beyond that, the most
logical next line of enquiry for most people is going
to be the Forum search, which, as we’ve seen, aint all
that.

I would not expect any newbies to even be aware of
the existence of the old synthesisters archives, but
it is a mine of useful info. When it briefly went
offline recently, Wally suggested that it was
scheduled to be scrapped sometime soon anyway, and I
for one, think that would be a mistake.

Out of interest, I tried comparing the forum search,
Googling c74/forum, and Googling Synthesisters for a
couple of other threads – and guess which came up on
top ?

Sure, you’re not going to find a lot about say, Java
or a any of the other more modern developments in Max,
but for basic Max/MSP q’s, there’s still a lot of
hoary old wisdom in there.

So until such time as the forum search can do a
better job, I would advise anyone needing to search
beyond the manuals, to Google synthesisters.com AND
cycling74.com/forums, rather than relying on the
forum’s own search engine – and _please_ can we keep
the old archives a bit longer :-)
cheers
Roger


January 26, 2007 | 12:57 pm

> >Because the forum search is a shit. It never works,
>for nothing, gives
> >you only 2 answers where you know there are dozens…

i am sorry to say i really second this

I am very happy with the max help files, doc etc, but this part of
help is really not well done – i recently tried to find a post (+
answers to it) that i have made (so i knew who did it, knew the
keywords) and was not able to find it…

anyhow

best

kasper

Kasper T. Toeplitz
noise, composition, bass, computer

http://www.sleazeArt.com

http://www.myspace.com/sleazeart


January 26, 2007 | 1:51 pm

Not sure this addresses the problem exactly but the list doesn’t have to be
indexed and changing 3 in the % and cycle to any other number generalizes
the solution.

#P window setfont "Sans Serif" 9.;
#P number 417 198 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 349 153 27 196617 + 1;
#P message 347 43 79 196617 1 2 3 4 5 6 7 8;
#P message 404 340 50 196617 3 6;
#P newex 404 312 62 196617 prepend set;
#P newex 404 288 39 196617 thresh;
#P message 324 340 50 196617 2 5 8;
#P newex 324 312 62 196617 prepend set;
#P newex 324 288 39 196617 thresh;
#P message 244 339 50 196617 1 4 7;
#P newex 244 311 62 196617 prepend set;
#P newex 244 287 39 196617 thresh;
#P newex 276 132 25 196617 iter;
#P newex 320 198 62 196617 prepend set;
#P newex 348 129 27 196617 % 3;
#P newex 294 222 118 196617 cycle 3;
#P message 268 43 70 196617 1 2 3 4 5 6 7;
#P message 190 45 61 196617 1 2 3 4 5 6;
#P newex 348 108 34 196617 zl len;
#P connect 17 0 5 0;
#P connect 17 0 18 0;
#P connect 4 0 17 0;
#P connect 16 0 6 0;
#P connect 16 0 0 0;
#P connect 2 0 6 0;
#P connect 2 0 0 0;
#P connect 1 0 6 0;
#P connect 1 0 0 0;
#P connect 3 2 13 0;
#P connect 14 0 15 0;
#P connect 13 0 14 0;
#P connect 3 1 10 0;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 3 0 7 0;
#P connect 8 0 9 0;
#P connect 7 0 8 0;
#P connect 6 0 3 0;
#P connect 0 0 4 0;
#P connect 5 0 3 0;
#P window clipboard copycount 19;

On 1/26/07 2:25 AM, "dlurk" wrote:

> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 58 196 27 9109513 + 1;
> #P newex 58 234 34 9109513 gate 2;
> #P newex 58 172 27 9109513 % 2;
> #P newex 26 142 42 9109513 buddy 2;
> #P newex 26 109 85 9109513 unpack 1 anything;
> #P newex 82 262 50 9109513 print even;
> #P newex 58 285 44 9109513 print odd;
> #P message 26 51 60 9109513 a b c d e f g;
> #P newex 26 79 46 9109513 listfunnel;
> #P connect 7 1 3 0;
> #P connect 7 0 2 0;
> #P fasten 5 0 7 1 31 225 87 225;
> #P connect 8 0 7 0;
> #P connect 6 0 8 0;
> #P connect 5 1 6 0;
> #P connect 4 1 5 0;
> #P connect 4 0 5 1;
> #P connect 0 0 4 0;
> #P connect 1 0 0 0;
> #P window clipboard copycount 9;

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson


January 26, 2007 | 6:57 pm

Gary Lee Nelson wrote:
> Not sure this addresses the problem exactly but the list doesn’t have to be
> indexed and changing 3 in the % and cycle to any other number generalizes
> the solution.

Your patch didn’t work for me – perhaps I just don’t understand how to
interpret the output, or it needed some sort of initialization. I was
inspired by your rejection of indexing though, so here’s another
generalization which does work here:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 199 63 78 9109513 1.5 7.3 forty-two;
#P newex 89 277 50 9109513 print even;
#P newex 65 301 44 9109513 print odd;
#P newex 75 168 21 9109513 b 1;
#P newex 100 105 27 9109513 t l 0;
#P message 117 63 77 9109513 1 2 3 4 5 6 7 8 9;
#P message 44 63 68 9109513 a b c d e f g h;
#P newex 65 218 27 9109513 + 1;
#P newex 65 248 34 9109513 gate 2;
#P toggle 65 198 15 0;
#P newex 100 139 21 9109513 iter;
#P connect 0 0 7 0;
#P connect 0 0 2 1;
#P fasten 6 1 1 0 122 131 70 131;
#P connect 10 0 6 0;
#P connect 5 0 6 0;
#P connect 4 0 6 0;
#P connect 6 0 0 0;
#P connect 2 1 9 0;
#P connect 2 0 8 0;
#P connect 3 0 2 0;
#P connect 7 0 1 0;
#P connect 1 0 3 0;
#P window clipboard copycount 11;


January 26, 2007 | 8:52 pm

Just copied the patch I sent from my own message and it does work. All it
was doing was gathering the input lists into three output lists. The first
list contain items 1 4 7 etc, the second, items 2 5 8 and the third items 3
6 9.

On 1/26/07 1:57 PM, "dlurk" wrote:

> Gary Lee Nelson wrote:
>> Not sure this addresses the problem exactly but the list doesn’t have to be
>> indexed and changing 3 in the % and cycle to any other number generalizes
>> the solution.
>
> Your patch didn’t work for me – perhaps I just don’t understand how to
> interpret the output, or it needed some sort of initialization. I was
> inspired by your rejection of indexing though, so here’s another
> generalization which does work here:
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P message 199 63 78 9109513 1.5 7.3 forty-two;
> #P newex 89 277 50 9109513 print even;
> #P newex 65 301 44 9109513 print odd;
> #P newex 75 168 21 9109513 b 1;
> #P newex 100 105 27 9109513 t l 0;
> #P message 117 63 77 9109513 1 2 3 4 5 6 7 8 9;
> #P message 44 63 68 9109513 a b c d e f g h;
> #P newex 65 218 27 9109513 + 1;
> #P newex 65 248 34 9109513 gate 2;
> #P toggle 65 198 15 0;
> #P newex 100 139 21 9109513 iter;
> #P connect 0 0 7 0;
> #P connect 0 0 2 1;
> #P fasten 6 1 1 0 122 131 70 131;
> #P connect 10 0 6 0;
> #P connect 5 0 6 0;
> #P connect 4 0 6 0;
> #P connect 6 0 0 0;
> #P connect 2 1 9 0;
> #P connect 2 0 8 0;
> #P connect 3 0 2 0;
> #P connect 7 0 1 0;
> #P connect 1 0 3 0;
> #P window clipboard copycount 11;

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson


January 26, 2007 | 11:01 pm

Gary Lee Nelson wrote:
> Just copied the patch I sent from my own message and it does work. All it
> was doing was gathering the input lists into three output lists. The first
> list contain items 1 4 7 etc, the second, items 2 5 8 and the third items 3
> 6 9.

Well that’s definitely what it does here! I think I did not understand
what you meant by "generalized" – is it that the structure / algorithm
can be adapted for any element frequency / skip period? (Sorry, I’m
sure there’s a better way to say that.)

I realized that the patch I sent before did not work for a number
sequence, so my second patch addressed that (and became more "general"
in that sense).

Thanks for the reply!


January 27, 2007 | 12:05 am

There’s an mxj patch in the java examples folder that will do this
exact thing. I think it’s mxj.deinterleave or something similar.

Peter McCulloch

On Jan 26, 2007, at 6:01 PM, dlurk wrote:

> Gary Lee Nelson wrote:
>> Just copied the patch I sent from my own message and it does work.
>> All it
>> was doing was gathering the input lists into three output lists. The
>> first
>> list contain items 1 4 7 etc, the second, items 2 5 8 and the third
>> items 3
>> 6 9.
>
> Well that’s definitely what it does here! I think I did not
> understand what you meant by "generalized" – is it that the structure
> / algorithm can be adapted for any element frequency / skip period?
> (Sorry, I’m sure there’s a better way to say that.)
>
> I realized that the patch I sent before did not work for a number
> sequence, so my second patch addressed that (and became more "general"
> in that sense).
>
> Thanks for the reply!
>


January 27, 2007 | 1:46 am

In case anyone else is prone to forget the regular C’74 Java library
classes, Peter McCulloch kindly pointed out the list.demultiplex class
stored in the C’74 resource directory (Lib… on Mac, Common… on XP).


January 27, 2007 | 5:08 pm

My example showed a three-way separation. By generalized I mead that you
can change the number of paths by replacing the 3 in cycle and % with, say,
17.

On 1/26/07 6:01 PM, "dlurk" wrote:

> Gary Lee Nelson wrote:
>> Just copied the patch I sent from my own message and it does work. All it
>> was doing was gathering the input lists into three output lists. The first
>> list contain items 1 4 7 etc, the second, items 2 5 8 and the third items 3
>> 6 9.
>
> Well that’s definitely what it does here! I think I did not understand
> what you meant by "generalized" – is it that the structure / algorithm
> can be adapted for any element frequency / skip period? (Sorry, I’m
> sure there’s a better way to say that.)
>
> I realized that the patch I sent before did not work for a number
> sequence, so my second patch addressed that (and became more "general"
> in that sense).
>
> Thanks for the reply!

Cheers
Gary Lee Nelson
Oberlin College
http://www.timara.oberlin.edu/GaryLeeNelson


January 27, 2007 | 11:04 pm

Gary Lee Nelson wrote:
> My example showed a three-way separation. By generalized I mead that you
> can change the number of paths by replacing the 3 in cycle and % with, say,
> 17.

Yes, great, very much appreciated! You took it to a level I wasn’t even
thinking about. :) I almost wish I had a reason to follow through and
set up an scripted abstraction to handle that automatically… maybe to
put myself to sleep tonight.


January 29, 2007 | 7:27 pm

Quote: maxplanck735@hotmail.com wrote on Thu, 25 January 2007 20:56
—————————————————-
> I’m trying to find an object that can:
>
> take a list at its input and, (assuming the list elements are indexed (1,2,3,4,…)
>
> send odd index numbered elements to one output, and even index numbered elements to the other output.
>
>
> Can anyone recommend an object or external, or combination thereof, that can do this?
>
> Thanks, any help is appreciated
—————————————————-

Look at the deinterleave object here:

http://www.cnmat.berkeley.edu/MAX/downloads/

mz


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