If/Then Toggle Problems

I’m trying to get an if-then powered toggle to act as a midi trigger for a set note. The problem is that no matter what number is set, the toggle will reset it to the arguments set in the if-thens. The only work around I can figure is to have a message set to the note I want. This method is more inconvenient because the patcher that this is a part of is HUGE and I need the notes to be more dynamic. Otherwise it will get even larger…

So does anyone have any suggestions as to how to keep the number set AND use the toggle as a midi trigger??

– Pasted Max Patch, click to expand. –

Copy all of the following text. Then, in Max, select New From Clipboard.

I’m not understanding yet, but the first thing that pops into my head would be to use trigger to specify the order of actions so you can store values in an int object or message box first, then bang them out if certain conditions are met… but I am too tired right now to actually understand what you are trying to do.

maybe the bigger picture will help to clarify. this patch uses silhouettes to control midi events. this specific version sends a bang to midiout to play a note. (unfortunately you have to reset it after each note). the problem is that if the note (through Rewire) has a high attack setting, then a bang is insufficient for the note to reach full value. i was thinking that a toggle might do the trick. if an object is in the silhouette then the note is played and held, if not it releases the note.

– Pasted Max Patch, click to expand. –

Copy all of the following text. Then, in Max, select New From Clipboard.