Author Options:

Is there a way to turn a computer keyboard into a MIDI controller? Answered

I've seen this question before, but what i'd like to know if there is a way to use a USB computer keyboard as a MIDI controller while still having other keyboard connected at the same time which I'd use as a regular computer keyboard


If you mean stand-alone: Hook the keyboard to a small computer (Arduino would easily do it, simpler ones can do it to) which reads the keyboard press/release codes and outputs the appropriate commands on to a MIDI stream.

If you mean on a PC: I don't think the standard USB keyboard drivers will let you distinguish keystrokes from one USB keyboard from those on another. I could be completely wrong on that.

hello, Where can I get instructions on how to connect to Arduino for that purpose?

Orksecurity is correct. Without an intermediate device to interpret they keyboard presses, trying to have two keyboards connected directly to the same PC simultaneously wouldn't work well.

Due to the way that the drivers work (I'm assuming this is a Windows based system?) the operating system doesn't differentiate between different keyboard devices. You just get a return from the system as what the current "key state" is, regardless of which device sets the key state. (I've created my own video game input engines, so have a little insight here.)

For something to be a USB midi controller would require either an intermediate device that interprets the keypresses and sends the OS a DIFFERENT singnal, or a complete rewrite of the USB drivers for the keyboard in question. Either way, the answer is: No, there's no easy answer.

Now, all of this being said, it IS possible to write a piece of software that uses the "Scroll Lock" which is a seldom, if ever used keyboard feature that they all seem to still have. With some fancy subclassing, you can have the software detect keypresses as MIDI sounds whenever the scroll lock is pressed, and as regular typing when not. I don't believe you'll be able to get at a low enough level to keep the OS from detecting the keypresses (allowing this tool to run in the background as a service) though.

That was of great help, thank you