Forums > Max For Live

Change list value by index at midi event

December 11, 2011 | 5:15 pm

Hi,
I want to programm a Step Sequencer which I can operate with an external controller and so I want to be able to change the list value representing the state of a step by an index number (There are only 2 states, 0 and 1 and so everytime I hit the Button for a certain step I want this number to be changed either to 1 or to 0)
But I wasn’t able to find a nice object in Max to do this. I Could only find this mxj list.replace java implementation but it didn’t worked properly for me.

Thanks a lot,
Greetings Sparsepix


December 11, 2011 | 9:10 pm

Try the [sel] object


December 11, 2011 | 9:13 pm

Or maybe this is what you were asking for…

– Pasted Max Patch, click to expand. –

December 12, 2011 | 5:52 am

yeah thanks, that works for inverting the value but I can’t see any way how to change the internal value of a list with this object. Could you help me out ?



MIB
December 12, 2011 | 6:15 am

have a look at the [zl nth] object. there you can replace any index of a list with a new value… I think that’s what you are asking for…


December 12, 2011 | 2:11 pm

nth: accepts a list in the left inlet and outputs the nth element of the list out the left outlet.

the tooltips of the outlets say that they output the nth element of the list on the left and the list without the nth element on the right … but I cant find a way to just change the nth element / put a new element in at the nth position ;/


December 12, 2011 | 2:33 pm

if the lenght of your sequencer is fixed or at least limited to a known length, [pack 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] will be your friend.



MIB
December 12, 2011 | 7:10 pm

not to seem grumpy, but read the entire help file for [zl nth]: extra argument to right inlet specifies . nth element will be replaced with in right oulet list.

– Pasted Max Patch, click to expand. –

December 12, 2011 | 9:59 pm

oh you’re so kind ! I where the hell did you find this ? I thought I looked up the whole reference page for zl ^^
Anyway thanks a lot I think that will fix my problem.
Greets Sparsepix


December 18, 2011 | 1:03 pm

hey i’m having a similar step sequencer related problem. I’m using the coloured buttons on an xbox 360 controller to input dater into the matrix control object. The butons work on 1′s and 0′s so when i press a button it show up on the matrixctrl.

any help would be appreciated.

Attachments:
  1. stepseqhelp.maxpat

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