Forums > MaxMSP

International keyboard accommodating

January 21, 2012 | 7:21 pm

I have an app that uses the key object to report which key is currently pressed on the computer keyboard. I am using this to simulate a musical keyboard on the computer keyboard. I have been using the leftmost outlet of the object to report the ASCII key number, which I then map to musical note numbers. See screenshot.

I now recognize a problem though, where with non-US keyboard layouts, the ASCII codes I’m expecting for a certain position on the computer keyboard are not those I’m expecting. No big deal, I will switch to the 2nd from the left outlet of the key object, and I believe that should fix things. But now I would like to do label the keys on the attached screenshot with the correct ascii letters that correspond to the keys, irrespective of which international keyboard map the user has loaded. How do I get those, from knowing the platform-specific keyboard code number?

[attachment=182846,3235]

Attachments:
  1. keyboard.png

January 22, 2012 | 2:55 pm

Found a solution – though I would have preferred to just use built in Max objects, Masayuki Akamatsu’s aka.keyboard allows me to send [key XX] messages, using the platform-specific keyboard code numbers, back to the key object, which in turn gets me the appropriate ascii value for the current international keyboard map.



pid
January 22, 2012 | 5:52 pm

sorry if i am missing the point, but doesn’t "KeyMidi" from the extras menu provide a quirky but working solution to this?

alternatively, couldn’t you create a little app (from max) that makes a .txt file that uzi’s out info about the keyboard, send it to all your friends around the world (or make an open call on the forum?!), and get them to send you back the file. then you’d have a database of keyboards you could use in coll or dict and find a way to localise it (or make it user selectable).

this would be a cool database to share!!

just thoughts.


January 22, 2012 | 6:55 pm

Thanks – I had never noticed that KeyMidi patch before! That does offer an interesting way to do this… Your other approach is interesting too, but I’d rather not rely on gradual buildup over time for broad-based support. Would also like a single solution for every possible keyboard layout….


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