building a shortcut rig

Brodie Matthews's icon

hey wanted to create some custom shortcuts, having 2 problems the key obj isnt reporting while a modifier obj is reporting and 2, based on (if $i1 (the modifier) & $i2(the key)) but adding $i2 will trigger the if statement anytime after by pressing the modifier unless i change $i2 with keyup or something?

Edit: iv found some code that solved the keyup situation,is there a way around using key and modifier together?

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

key object outputs ascii code dependent of modifier key, as it should right ?
Maybe you should use keyboard code outlet insted ?

Brodie Matthews's icon

Thanks.it looks like the key obj only outputs a modifier if a key is pressed as well? Just generally harder to work with i need to take another look i guess.

Brodie Matthews's icon

i can make it work.i was confused trying to use shift/ctrl + 2..some keys dont post?

Brodie Matthews's icon

i just noticed in my original code if you press the modifier after the key it reports

Brodie Matthews's icon

but then keyup doesnt report😅

Brodie Matthews's icon

I tried what you suggested and set key to keyboard, is working but modifiers arent reporting ctrl.

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon


i always use [key] and [modifier] together and it somehow makes sense, because modifiers are normally to be pressed earlier. so the order of messages, how you bring the information together, is also always the same.

for example you could layout all your patches like that:

[modifiers] [key]
[gate]

and it will always do what you want.

Source Audio's icon

Take a look at this example.
You can easily see what key object outputs while key is held
and modifier key gets pressed ...
I prefer sum than gate

Max Patch
Copy patch and select New From Clipboard in Max.

P.S. one can use non modifier keys to match the string,
up to 6 keys can be used on usual keyboards.
For example hold a s d, summ their state to open or close gate
to pass num keys through.

Brodie Matthews's icon

thanks for going in on this.i opened the code, it must be my machine because im still not getting all the presses.demo >>video

shift works perfect but ctrl and alt are acting weird.

Brodie Matthews's icon

Im hype that shift works my og code is solid. must be my machine, i know sometimes overiding keys can mess with things. Iv used these objs before and never had any issues..*gets the magnets out

Source Audio's icon

If you only use modifier object and it does not report all the keys, then someting
is wrong with your computer, max installation or something else.
Are you on Mac or Windows ?

Brodie Matthews's icon

windows, I can try another pc.

Brodie Matthews's icon

sup guys, coming back to this if i wanted to pass incoming keypresses from ableton to a device how would this be done?