Development Tip

피아노 키보드를 컴퓨터 키보드로 사용

yourdevel 2020. 9. 29. 18:46
반응형

피아노 키보드를 컴퓨터 키보드로 사용


나는 RSI 문제가 있고 30 개의 다른 컴퓨터 키보드를 사용해 보았는데이 모든 것이 나를 고통스럽게 만들었다. 피아노를 쳐도 고통을주지 않습니다. 나는 통증 문제없이 약 20 년 동안 피아노를 연주했습니다. MIDI 키보드에서 MIDI를 캡처하고 키보드 스트로크를 출력하는 방법이 있는지 알고 싶습니다. MIDI에 대해 전혀 알지 못하지만이 신호를 키 입력으로 변환하는 방법에 대한 지침이 필요합니다.


완전한 midi 지원 (BASS)이있는 .NET의 좋은 라이브러리는 http://www.un4seen.com방문하십시오 .

그리고 키보드 미디 노트를 키 등으로 번역하는 다른 부분에서는 AutoItX, ActiveX / COM 및 DLL 인터페이스를 autoIt로 이동합니다. 정보 및 다운로드는 http://www.autoitscript.com/site/autoit/ 로 이동 하십시오.

키보드 드라이버를 작성할 필요가 없습니다.


나는 몇 년 동안 어떤 MIDI 프로그래밍도 해본 적이 없지만, 당신의 기본 아이디어는 매우 건전합니다 (말장난이 아님).

MIDI는 "이벤트"(또는 "메시지")의 스트림으로, 가장 기본적인 두 가지는 "note on"과 "note off"로 음표 번호 (0 = C 중간 C 아래 5 옥타브, 127 = G 중간 C 위의 G보다 5 옥타브, 반음). 이러한 이벤트는 속도에 민감한 ( "터치에 민감한") 키보드에서 "속도"숫자를 전달하며, 힘은 0에서 127 사이입니다.

벨로 시티, 코드, 페달 사이에서 피아노 키보드를위한 꽤 좋은 "타이핑"인터페이스를 생각 해낼 수있을 것 같습니다. 특히 코드는 매우 강력한 기술이 될 수 있습니다. 제가 주석에서 언급했듯이, 평범한 속기사가 속기 기계사용하여 사람들이 몇 시간 동안 연속적으로 이야기하는 것을 유지할 수 있습니다. 일반 타자기 스타일의 키보드를 통해 원하는 시간 동안 사용할 수 있습니다. 기계 속기 법과 마찬가지로 코드 및 코드 시퀀스의 의미에 대한 "사전"이 필요합니다. (내가 기계 속기의 소프트웨어 측면에서 일 했었다고 말할 수 있습니까?)

이를 위해 기본적인 부분은 다음과 같습니다.

  • MIDI 입력 수신. 직접 시도하지 말고 라이브러리를 사용하십시오. 편집 : 분명히 Java Sound API MIDI 컨트롤러에서 이벤트 수신을 포함하여 MIDI를 지원합니다 . 멋있는. 이 페이지 도 유용 할 수 있습니다.
  • 예를 들어 위에서 언급 한 사전을 통해 해당 데이터를 보내려는 키 입력으로 변환합니다.
  • 컴퓨터에 키 입력을 출력합니다.

소프트웨어와 가장 광범위하게 호환 되려면 이것을 키보드 장치 드라이버로 작성해야합니다. 이것은 키보드 이벤트의 소스 역할을하는 운영 체제에 대한 플러그인으로, 기본 하드웨어 (귀하의 경우 피아노 키보드)와 통신합니다. Windows 및 Linux의 경우 아마도 C를 사용하고 싶을 것입니다.

그러나 키 입력을 생성 하고 있기 때문에 (수년 전에 시도했던 것을 가로 채려고하지 않음), 인공 키 입력을 보내기 위해 운영 체제의 모든 기능을 사용할 수 있습니다. Windows에는이를 수행 할 수있는 인터페이스가 있습니다 (아마도 몇 가지, 제가 생각 SendInput하는 것은 비슷한 작업을 수행하는 "저널"인터페이스가 있음을 알고 있습니다). 다른 운영 체제도 마찬가지라고 확신합니다. 그것은 당신의 목적에 충분할 수 있습니다. 장치 드라이버 경로가 어색 할 것이고 아마도 Java와 다른 언어를 사용해야 할 것이기 때문입니다. (저는 Java의 팬이지만 운영 체제가 장치 드라이버와 통신하는 데 사용하는 인터페이스는 C 등을 통해 더 쉽게 소비되는 경향이 있습니다.)


업데이트 : 키 입력에 대한 코드의 "사전"에 대한 추가 정보 :

기본적으로 사전은 가장 긴 접두사 일치로 검색 하는 trie (감사합니다, @Adam)입니다. 세부:

기계 속기에서 속기사는 속기 기계에서 동시에 여러 키를 누른 다음 모두 놓아서 작성합니다. 그들은 이것을 키보드의 "스트로크"라고 부릅니다. 피아노에서 코드를 연주하는 것과 같습니다. 뇌졸중은 자주 (항상 그런 것은 아님) 구어의 음절에 해당합니다. 음절과 마찬가지로 때로는 한 획 (코드)이 그 자체로 의미가있는 경우도 있고 다음 획과 결합 된 의미 만있는 경우도 있습니다. ( "좋은"대 "좋은"다음에 "안녕"을 생각하십시오.) 비록 그들이 공부 한 학교의 영향을 많이받을 것이지만, 각 속기사는 그들이 무엇을 의미하기 위해 사용하는 획에 대한 자신의 "사전"을 갖게 될 것입니다. 즉, 그들이 일하는 동안 지속적으로 연마 할 사전입니다. 사전에는 속기 부분 (줄여서 "steno")이 한 스트로크 길이이거나 여러 스트로크 길이 인 항목이 있습니다. 종종 길이와 후속 스트로크로 구분되는 동일한 시작 스트로크를 가진 여러 항목이 있습니다. 예를 들어 (여기서는 실제 steno를 사용하지 않고 자리 표시 자만 사용합니다) 다음 항목이있을 수 있습니다.

A = 알파
A / B = 알파벳
A / B / C = 알파벳
A / C = 에어컨
B = 벌
B / C = 때문에
C = 바다
D = 개
D / D = 디디

(이 문자는 음표가 아니라 추상적 인 표시 일뿐입니다.)

A여러 항목 시작하고 C을 번역하는 방법 은 이전에 A, a를 보았는지 B또는 새로 시작 하는지에 따라 다릅니다 .

또한 (위의 아주 작은 샘플에는 표시되지 않았지만) 동일한 단어 나 구문을 하나가 아닌 여러 가지 방법으로 "재생"할 수 있습니다. 속기사는 손의 위치에 따라 앞의 단어에서 다음 단어로의 흐름을 더 쉽게하기 위해 그렇게합니다. 거기에는 음악에 대한 명백한 비유가 있으며,이를 사용하여 피아노 연주에 부정적인 영향을 미치는 것을 방지하고 실제로 RSI에 도움이 될 가능성을 최대화하기 위해 음악 연주와 유사한 타이핑 흐름을 만들 수 있습니다.

steno를 표준 텍스트로 번역 할 때 다시 "가장 긴 접두사 일치"검색을 사용합니다. 번역 알고리즘은 기록 된 첫 번째 스트로크로 시작하고 해당 스트로크로 시작하는 항목을 찾습니다. 항목이 하나만 있고 스트로크가 하나 인 경우 "사용할 항목입니다"라고 안정적으로 말하고 해당 텍스트를 출력 한 다음 다음 스트로크로 새로 시작할 수 있습니다. 그러나 그 스트로크는 다양한 길이의 여러 항목을 시작합니다. 그래서 우리는 다음 스트로크를보고 그 두 스트로크로 시작하는 항목이 순서대로 있는지 확인합니다. 그리고 우리가 일치 할 때까지 계속합니다.

따라서 위의 사전에서 다음 시퀀스를 보았다고 가정합니다.

ACBBCABCABD

번역 방법은 다음과 같습니다.

  1. A다양한 길이의 세 항목의 시작입니다. 다음 스트로크를보십시오 :C
  2. A/C하나의 항목 만 일치합니다. "에어컨"을 출력하고 다음 스트로크로 새로 시작합니다.B
  3. B두 항목을 시작합니다. 다음 스트로크를보십시오 :B
  4. B/B아무것도 시작하지 않습니다. 가장 긴 이전 일치 항목 ( B)을 가져 와서 출력 ( "bee")
  5. output B= "bee"인 경우에도 B버퍼에 스트로크가 있습니다. 두 개의 항목이 시작되므로 다음 스트로크를보십시오.C
  6. B/C하나의 항목과 일치합니다. "때문에"를 출력하고 다음 스트로크로 새로 시작합니다.A
  7. A세 항목을 시작합니다. 다음 스트로크를보세요 :B
  8. A/B두 항목을 시작합니다. 다음 스트로크를보세요 :C
  9. A/B/C하나의 항목 만 일치합니다. "알파벳"을 출력하고 다음 스트로크로 새로 시작합니다.A
  10. A세 항목을 시작합니다. 다음 스트로크를보십시오 :B
  11. A/B두 항목을 시작합니다. 다음 스트로크를보십시오 :D
  12. A/B/D일치하는 항목이 없으므로 가장 긴 이전 일치 항목 ( A/B)을 사용하여 "알파벳"을 출력합니다. 그것은 우리를 D여전히 버퍼에 남겨 둡니다 .
  13. D두 개의 항목을 시작하므로 일반적으로 다음 스트로크를 살펴 봅니다.하지만 모든 스트로크를 처리 했으므로 별도로 고려합니다. 분리하여 "개"로 번역되어 출력됩니다.

주의 할 위의 측면 :

  • 읽었지만 아직 번역하지 않은 스트로크 버퍼가 있습니다.
  • 가능한 한 단일 항목에 대해 항상 가장 많은 스트로크를 일치 시키려고합니다. A/B"alpha"및 "bee"가 아닌 "alphabet"으로 번역되어야합니다.
  • (Not shown above) You may well have sequences of strokes that you can't translate, because they don't match anything in the dictionary. (Steno people use the noun "untranslate" -- e.g., with our dictionary, the strokes E would be an "untranslate".)
  • (Not shown above) Some theories of steno allow the same set of strokes to mean more than one thing, based on a broader context. Steno people call these "conflicts". You probably want to disallow them in your project, and in fact when steno used to be translated manually by the stenographer, conflicts were fine because they'd know just by where in the sentence they were what the right choice was, but with the rise of machine translation, conflict-free theories of steno arose specifically to avoid having to go through the resulting translated text and "fix" conflicts.
  • 실시간으로 번역한다는 것은 (당신이하고있는) 부분적인 일치를 받으면, 다음 코드를 기다리는 동안 그것을 유지하고 싶을 것임을 의미합니다. 그러나 아마도 타임 아웃까지만 가능합니다. 가능한 한 버퍼에있는 것을 번역하십시오. (또는 시간 초과를 원하지 않을 수도 있습니다. 귀하의 전화입니다.)
  • "이전 뇌졸중 무시"라는 뇌졸중을 사용하는 것이 가장 좋습니다.
  • "아무것도 출력하지 않고 버퍼를 완전히 지운다"는 스트로크를 사용하는 것이 가장 좋습니다.

USB (또는 ps / 2?) 키보드를 에뮬레이트하는 하드웨어에서 작업을 수행하는 것을 고려하십시오. 더 이상 특정 OS 또는 특정 OS API에 의존하지 않습니다. 하드웨어 솔루션은 시간의 시험을 견딜 것입니다. 다른 모든 사람이 Windows 11을 실행 중일 때 Windows 7에서 이전 API를 사용하는 데 멈춰 있지 마십시오! Arduino 는 배우기 매우 쉽습니다.

Arduino에 대한 많은 정보와 도움이 있습니다. 초보자를 위해 만들어진 하드웨어 해킹 플랫폼입니다. 구글이 아두 이노를 추진하고 있기 때문에 이제 더 커질 것 입니다.

편집 : 가상 USB 키보드 소프트웨어하드웨어


직접 만드는 방법에 대한 조언을 덜 찾고 원하는 것을 달성하기 위해 이미 어떤 리소스가 있는지 묻는 것 같습니다. OS에 따라 프로그램을 처음부터 작성하지 않고도이를 수행 할 수있는 여러 가지 방법이 있습니다.

MIDI 스트로크

비어 있는. 들어 맥 OS X 10.3까지 . 이것은 특별히 "모든 MIDI 키보드를 완전한 컴퓨터 키보드 교체로 사용할 수있는 기능"과 함께 제공됩니다 .

Bome의 MIDI 번역기

무료 / 엽서 (조금 이상합니다). 내용은 Windows 2000 및 최대 및 Mac OS X . 처음에는 AutoHotkey 유형 사용에 더 적합하게 보이지만 더 자세히 살펴보면 원하는 것을 멋지게 할 수 있다고 생각합니다.

최대 및 일명 키보드

비어 있는. 들어 맥 OS X . "즉시 사용 가능한"솔루션은 아니지만 기본 장치 구성에 익숙하다면 그렇게 나쁘지 않아야합니다.


MIDI DotNet 에서 .NET의 소스 코드 샘플로 하드웨어에 액세스 할 수 있습니다 .

MIDI 노트 데이터 스트림을 생성하는 소스 코드로 완전한 작업 샘플은 VB 5 / 6-Tipp 0521 : MIDI-Töne erzeugen (Visual Basic 6.0, 어딘가에 .NET 버전도 있음)에 있습니다.

키보드 스트로크를 시뮬레이션하는 방법은 VB 5 / 6-Tipp 0155 : Tastaturereignisse simulieren (Visual Basic 6.0, 어딘가에 .NET 버전도 있음)에 있습니다.

키 입력 인식은 Tipp-Upload : VB.NET 0266 : Globaler KeyHook에 설명되어 있습니다.

여기에 이미지 설명 입력

그런 다음 피아노 연주자에게 좋은 작업 매트릭스를 사용하십시오. 티모 보메 www.goldengel.ch

On piano and when you're a good player, you can have 10 fingers on the keyboard and if the matrix is usable you can be much more quickly that any computer keyboard user I think. :-)

In that case, if I understand your question right, it should not be a big thing.


I studied piano performance in college and then got into interaction design, programming, and using Vim, so I have actually spent a lot of time prototyping things like this.

You can get this working pretty quick in Linux by using the graphical programming language for multimedia artists, "Pure Data," along with the x11key external by Alex Andre.

On Mac, you can use MidiStroke. I believe a method on Windows involved the MidiOx and AutoHotKey tools. At another time I had a version going using the Java plugin for Max/MSP. I believe Patrice Colet made a windows external for Pure Data that worked as well, but I can't seem to locate it anymore. Also, there's an external for MaxMSP that can do this on Windows. Finally, the non-free but awesome Osculator can do what you want - see the features page.

When I got it working, I never stuck with it, because I couldn't stop tooling with the layout. It was cool just having my monitor on my electric keyboard, though! Good luck.


About MIDI

You stated that you "know nothing at all about MIDI". MIDI technology is fairly straight-forward once you grasp it, but it can be confusing at the outset. One of the resources that has been tremendously helpful for me in understanding the foundations for MIDI (which are certainly necessary if you want to program MIDI interactions), is a book called MIDI for the Technophobe. It's an easy book to read and is very helpful.


Pure Data & Max

In my experience developing interactive multimedia, there are two very similar programs I have encountered that facilitate connecting and mapping signals/inputs from any device.

These are Max for a Mac environment and Pure Data for a PC environment. Both have a plethora of online documentation and YouTube tutorials. The video Max/MSP Tutorial 1 - using your computer keyboard as midikeyboard (ableton style) demonstrates a program built in Max that maps a computer keyboard to a MIDI keyboard's inputs (which is basically the exact opposite of what you are trying to do). You could get your intended results by using the same pattern, but reversing the signals/mappings.


AutoHotKey

AutoHotKey is a free open source utility for Windows that allows you to remap keys and buttons on your devices to macros. It natively supports QWERTY keyboards, joysticks and mouse macros.

However, I was able to find an implementation supporting the specific mapping you are looking for. These two threads explain the process:

  1. MIDI IN support in AutoHotkey , the discussion of the use case. The author was looking for a program that could detect MIDI IN input and translate that to keypresses.

  2. MIDI input library , the solution to the author's problem and the posted code/patch to AutoHotKey which actually implements your intended result.

Basically, it looks like AutoHotKey, along with this user's custom patch, will provide exactly what you need to create a mapping from a MIDI keyboard to a QWERTY keyboard's input signal. All you would have to do is install, configure and define your mappings.


Anything else?

Some of the other answers have given you much more extensive information on MIDI and MIDI programming, in general, but as your post states that doesn't seem to be quite what you are looking for. I would like to help you more if possible, but it would be easier if you could be more specific about the type of information you are looking for. For instance, are you more interested in how to convert a MIDI keyboard's input signals to a QWERTY keyboard's signals, or is your primary interest finding an out of the box solution to your specific problem? What are you looking for that has not yet been addressed?


You could hack your own USB keyboard pretty quickly using a Teenys micro controller.

In fact, they have example code for how to make a USB keyboard.

You could approach this two ways:

  1. Get an old piano and wire up switches directly to the teensy

  2. Add the additional logic to connect to the MIDI port and necessary decoding.


Actually, I worked on this a while ago, trying to capture Rock Band drum inputs into my computer (making a little Java homemade drum emulator) Anyway, I asked a question on here about that, Time delay problem (there is polling code in there, along with what I was attempting to do.). And if I can find my program I can give you the code, it uses a third-party API (JInput).

Good luck either way.


Try Bome's MIDI translator.

It works cross platform, can convert any MIDI input to a keystoke easily, quick to setup and configure, plus it's free for personal use.

There is a tutorial, Quick Tip: MIDI Translation – MIDI to Keystrokes, of how to easily set it up:

Basically, there are infinite possibilities of what you can do, including chording and modifier keys. I use it for my live audio rig to control my DAW using my piano and have never had an issue.


In Java, you can use JMF (Java Media framework) to convert MIDI signals. Basic of keyboard design is easy to use, that is, the user interface; and place frequently used charcter/symbol handy.

The sample code and API in Java Sound Resources: Examples: Digital Signal Processing (DSP) help to understand how to process the signal.

Some more references:


There is a program called GlovePIE. You can program it in a simple scripting language, and I believe it supports MIDI. I'm not sure if this fits under the "Java" category, but still, it is a great program. I've used it to control robots using PS3 controllers. It's very powerful.


Many keyboards have a serial port (RS-232) connector to send MIDI signals to the computer. I use a program called Girder to convert serial port communication into keyboard strokes.

Girder has a "mapping" feature that lets you map each key, one by one, to the corresponding keystroke.

This might be the simple solution you're looking for!


Just learn stenography!

It's clear from all the discussion on your part. You don't want to re-invent any wheels, from a technical standpoint. But once you have a connection made (what this question is asking) and up and working, you still have most of the work ahead of you: You have to train your brain. You also have to invent the cleverest, most efficient way to do that - a design issue totally out of the rhealm of computer techies. You or any of us would fall short.

Fortunately, the problem has been solved and honed though centuries of maturing...

Learn stenography!

Yes, this will set you back some jack. But what are hundreds of hours of your own time worth, with at the end, a less favorable result? Besides, the stenography Wikipedia article says, 'it looks more like a piano keyboard'.

Unless, of course, you want to have a sideshow effect going. I would have to admit, I never thought of this possibility, it it would be really entertaining to see somebody bust out a text from a piano keyboard!

You could start with a USB keyboard with touchpad (or a pointing stick would be more ergonomic?), use Plover to translate it (I'm sure it can be configured to let the non-letter keys retain their functionality as they are critical for programming), or, follow the thread Re: Plover keyboard to roll your own USB stenography keyboard, or, buy a stenotype.

Good luck!


Take a look at MAME arcade gaming. They have built hardware devices to allow input from any number of different items. The iPac, for example, converts signals from input devices into USB that the computer can then use to emulate keys. You could use any combination of input devices arranged any way that seems comfortable with no crazy programming logic required--because the software to interpret input is already done and well tested.

I've seen flight simulator cockpit inputs, custom kiosks, and voting systems built in this method.....and the price is right!


To solve this you will need a few things:

  1. A way to capture MIDI data from your keyboard. Depending upon the interface: MIDI interface (classic) or USB MIDI interface (modern) the most likely interface is to a computer as it provides the most options. USB host microcontrollers are not as simple as just using a computer.

  2. A scheme to convert MIDI data into keystrokes. Like one user pointed out, chords are the way to go as the number of keys will not be dependent upon the number of piano keys.

  3. A way to inject a key into the operating system. This will require a low-level driver to be accurate. I have played around with applications that inject keyboard and mouse data into applications in Windows 7, and it can be flaky and depend upon whether an application is currently in focus. This is hardest part of the interface. What may work is to create a HID USB keyboard microcontroller that also has a serial interface.

The serial interface would create a virtual serial port. The software that reads the MIDI data and produces the keystrokes could send a serial message to the virtual serial port. The microcontroller would send a keystroke so it would look like a standard keyboard input. This would allow interfacing both MIDI ports and USB MIDI keyboards.

Hmmm, with this type of interface you could also simulate a mouse and use some piano keys setup for the mouse axis and buttons. The pressure could be used to determine mouse pointer velocity. So you could eliminate the mouse as well. Another benefit of this approach is any type of input device you connect could talk to the virtual serial port to produce keyboard and mouse events. So if you wanted to add other hardware such as drum pedals or a joystick it would be a matter of adjusting the program that talks to the serial interface.

Another take on the above is like some posted above to use an Arduino, but also include USB Host Shield from Sparkfun to handle USB based music keyboards. This allows the Arduino to be programmed as a keyboard or keyboard mouse combo in the boot loader chip and allows the device to act a USB host for the USB based music keyboard. Then you are covered for both types. Although, I still think the virtual serial port method is more flexible and would be easier to program in the long run. The Arduino device will be harder to change than a desktop program or service.

There is another possibility: Chorded one handed keyboards already exist. I have seen videos on them, but you would have to determine if those hurt your hands or not.


It should be fairly easy using something like the .NET DirectSound interface to hook into an MIDI device. You will need to identify your target MIDI device and then get the code to listen in on the incoming messages (there are articles about doing this via Google).

Since you are using the MIDI in as a keyboard there are basically only two MIDI messages that you need to detect, namely note on and note off. The MIDI message is three data bytes specifying the command, the note and the velocity. The note off is just the note number (sometimes 'bad' MIDI stacks send a note on with zero velocity which you also have to expect).

Once you have the messages translating them the keyboard output should be fairly simple from .NET.

There is plenty of advice in the other answers about the technicalities; I just wanted to give you an idea of the actual MIDI messages. Good luck!


You'll get better and happier results (regardless what operating system and/or DAW program you like to use) by playing any external MIDI keyboard as a controller through your sound card. Then route that into your GB software (or whatever) and tone generate the many sounds they have supplied you that way in real-time.

If your sound card does not support MIDI I/O's (ins / outs /thrus), that's not a problem. You can consider researching and investing in an external MIDI table top converter. Many are equipped to further convert MIDI outs to USB 2.0 (by- passing an existing sound card altogether).

For example: it's pretty tough getting "human like" grace note results via a Z and X change key option using a computer keyboard and pencil tool. When, instead, your own fingers can just play that with a MIDI keyboard from its own physical octave register ranges—immediately!

I realize budgetary constraints may be involved. But, some of these seemingly cheap "Casio" type 5 octave keyboards sold at Radio Shack for under $100.00 U.S. Dollars (*or less) is all you would need (plus, some of their on-board sound patches and sequencer modules sound and handle amazingly well for other things too).

RadioShack MIDI keyboard options.

As for external MIDI converters for existing sound cards, I've run some Google searches for you as follows with Mac platforms specifically in mind:

A lot of this external MIDI conversion information may be cumbersome to you at first, so I've broken down things more as "user friendly" for your considerations & budget:

There's nothing wrong with facilitating virtual keyboards as VST's when using DAW. They have their place.

But, you sound like an accomplished keyboardist. So, why not consider the external MIDI conversion / keyboard options I just mentioned for yourself?

Good luck and I hope this gave you some ideas that can and will work for you!


If you don't want to do any programming yourself but just want the problem solved you can just buy a USB-MIDI-keyboard where you can re-assign any key to send a QWERTY keyboard output signal instead of a MIDI-output, for example M-Audio Axiom Pro

This method will work with any OS and any computer that supports standard USB-keyboards since the MIDI-keyboard will identify itself as a standard QWERTY keyboard.


You can use a simple AutoIt script to both read MIDI events, see MIDI Input.

You'll also need MIDI UDF and simulate key presses.

Reading MIDI events should be easy, but different MIDI controllers (instruments) have different features. Try to find out what your MIDI piano can do first, then see how you can best map those features to simulated QWERTY-keyboard presses.

If you want, you could have something on screen or in the tray to help you see what you are doing (that is, for Shift, Ctrl and Alt simulation).


You might take a look at chorded keyboards. They have the advantage that you don't need to write a driver for them before you can use them, and some are similar to the layout of a piano keyboard.


If you know coding in Java, you could use this way:

First, implement a javax.sound.midi.Receiver with a send(..) method that is mapping the 'Note on' events to keystrokes like you want.

You would need to get the MidiMessage's content with its getMessage method and intepret it in your fashion. The meaning of the message bytes can be found in MIDI Messages.

After receiving a 'note on' or 'note off' for a certain keyboard key, you may map that to a key you like by assigning it a constant of the KeyEvent class, something like C#4 -> KeyEvent.VK_A and so on. This key code can then be used by java.awt.Robot's keyPress and keyRelease methods to actually send the keystroke to the OS and thus to other applications.


I agree with Brian O'Dell's answer - if this were my project, I'd do it in hardware. It has the advantage of being platform and hardware independent - your box replaces the need for a MIDI-USB interface and a PC API.

mbed is a fast-prototyping platform that is very easy to learn, and has multiple advantages over Arduino IMHO (online compiler, 512 KB flash, 96 MHz, C++ language). It has a USB keyboard interface and a USB Midi interface pre-written for you.

The community is very friendly and willing to help, and there are a lot of existing projects using both MIDI and USB hid emulation - search Youtube for "mbed MIDI" or similar.


If you use Linux have a take at Footware.

It should be exactly what you're looking for - if you adjust the MIDI pitches to a keymapping of your liking...

I never thought this could be useful for anyone but me ;o)


Try using a microcontroller-based system, like Arduino.


This wouldn't be too tough.

I'm assuming you're on Windows, not sure about that though. I've written a MIDI sequencer, http://pianocheetah.com, in plain old C++, and it lets you use the piano keyboard to run commands. There isn't any reason you couldn't do the same thing to push keys into the keyboard input stream.

But come on now. You remember how long it took you to learn the keyboard in the first place, right? Are you willing to go through that again? And are you willing to pollute your blessed keyboard with a bunch of stupid looking key symbols all over it?

You'll need to use at least 26 alpha, 10 numeric, 11 punctuation, and at least 12 function keys AND their shifted states. So that's 60 keys plus shifted states. That'll burn up a full 5 octaves of keys. You will be doing piano "hops" =all= the time. Say goodbye to touch typing.

You may save yourself from RSI, but you've created another different type of nightmare for yourself.

And good luck getting your boss to buy you a MIDI keyboard at work.

진정한 피아노 연주법을 배웠다면 스트레스없이 연주하는 법을 배웠을 것입니다. 온 그렇게 쿼티 (QWERTY) 키보드. 긴장이 없습니다. 천천히 시작하십시오.

참고 URL : https://stackoverflow.com/questions/5928061/using-a-piano-keyboard-as-a-computer-keyboard

반응형