Forums > MaxMSP

Swapping values in table

July 24, 2011 | 4:03 am

Is there an easy way of swapping one value with another, as defined by a table or CSV? For example, I want to swap:

1 -> 4
2 -> 6
3 -> 5
4 -> 2
5 -> 1
6 -> 3

The first number would be sent in an inlet, and the second number would be sent from an outlet.

I’m very new to Max, coming from using ControllerMate. Any help is appreciated.

Thanks!



MIB
July 24, 2011 | 4:17 am

have a look at the coll object. it should do the trick

– Pasted Max Patch, click to expand. –

July 24, 2011 | 4:23 am

Perfect, this is just what I needed! Thanks :)


July 24, 2011 | 4:49 am

Lo and behold, my first Max patch!

(edit: hold on, making some adjustments)


July 24, 2011 | 4:56 am
– Pasted Max Patch, click to expand. –

Now, why are all the notes sounding so short?



MIB
July 24, 2011 | 6:22 am

they are short because you didn’t give them a length ;)

– Pasted Max Patch, click to expand. –

July 24, 2011 | 6:57 am

Well according to the help docs, the duration value isn’t necessary. If duration is not defined, non-zero velocity values hold until the velocity value is zero. I’ve got the notes holding longer here:

– Pasted Max Patch, click to expand. –

What I’m trying to do, is when the key is pressed, the velocity is 127, and then the key is released, the velocity goes to 0. That isn’t happening, however. I think it has something to do with the right-left processing, as when I do this:

– Pasted Max Patch, click to expand. –

it goes back to doing very short notes with the velocity reading 0. Can somebody shed light on this situation? I can’t seem to figure it out.


July 24, 2011 | 9:19 am

You don’t really want makenote in this case:

– Pasted Max Patch, click to expand. –

July 24, 2011 | 4:06 pm

Wow great, thanks!


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