我有RSI问题,尝试了30种不同的电脑键盘,都让我很痛苦。弹钢琴不会给我带来痛苦。我已经弹钢琴20年了,没有任何疼痛问题。我想知道是否有一种方法可以从MIDI键盘捕获MIDI并输出键盘敲击。我对MIDI一无所知,但我想要一些关于如何将这个信号转换成按键的指导。
当前回答
您可以在MIDI DotNet中使用。net中的源代码示例访问硬件。
创建MIDI notes数据流的完整工作示例是在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版本)
和识别击键在tip - upload: VB中有描述。NET 0266: Globaler KeyHook。
然后,为钢琴演奏者使用一个良好的工作矩阵
在钢琴上,如果你是一个优秀的演奏者,你可以有10个手指在键盘上,如果矩阵是可用的,我认为你可以比任何电脑键盘用户更快。: -)
在这种情况下,如果我没有理解错你的问题,这应该不是什么大事。
其他回答
关于MIDI
你说你“对迷笛一无所知”。一旦掌握了MIDI技术,它就相当简单,但在开始时可能会令人困惑。有一种资源对我理解MIDI的基础(如果你想编程MIDI交互,这当然是必要的)有极大的帮助,那就是为技术恐惧者写的一本叫做MIDI的书。这是一本容易读的书,非常有用。
Pure Data & Max
在我开发交互式多媒体的经验中,我遇到过两个非常相似的程序,它们有助于连接和映射来自任何设备的信号/输入。
这些是Mac环境下的Max和PC环境下的Pure Data。两者都有大量的在线文档和YouTube教程。视频Max/MSP教程1 -使用计算机键盘作为MIDI键盘(ableton风格)演示了Max内置的一个程序,该程序将计算机键盘映射到MIDI键盘的输入(这基本上与您正在尝试做的完全相反)。您可以通过使用相同的模式,但是反转信号/映射来获得预期的结果。
自动热键
AutoHotKey是一个免费的Windows开源实用程序,允许您将设备上的键和按钮重新映射到宏。它本机支持QWERTY键盘,操纵杆和鼠标宏。
但是,我能够找到支持您正在寻找的特定映射的实现。下面两个线程解释了这个过程:
MIDI IN支持AutoHotkey用例的讨论。作者正在寻找一个程序,可以检测MIDI输入并将其转换为按键。 MIDI输入库,作者的问题的解决方案和发布的代码/补丁AutoHotKey,它实际上实现了您预期的结果。
基本上,它看起来像AutoHotKey,以及这个用户的自定义补丁,将提供您所需要的创建从MIDI键盘到QWERTY键盘的输入信号的映射。您所要做的就是安装、配置和定义映射。
还有别的事吗?
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?
考虑在硬件上模拟usb(或ps/2?)键盘。您将不再依赖于特定的操作系统或特定的操作系统API。硬件解决方案将经受住时间的考验。当其他人都在使用Windows 11时,不要在Windows 7中使用旧的API !Arduino很容易学。
Arduino MIDI硬件是现成的 Arduinos已被用于模拟键盘设备
有很多关于Arduino的信息和帮助。这是一个为新手打造的硬件黑客平台。现在谷歌正在推广Arduino,它只会变得更大。
编辑:虚拟USB键盘软件和硬件
要解决这个问题,你需要做一些事情:
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. 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. 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.
串行接口将创建一个虚拟串行端口。读取MIDI数据并产生击键的软件可以向虚拟串行端口发送一个串行消息。微控制器将发送一个击键,使它看起来像一个标准的键盘输入。这将允许同时连接MIDI端口和USB MIDI键盘。
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.
还有另一种可能: 单手和弦键盘已经存在。我看过关于它们的视频,但你必须确定它们是否会伤害你的手。
使用. net DirectSound接口这样的东西来连接到MIDI设备应该是相当容易的。您需要识别目标MIDI设备,然后获取用于侦听传入消息的代码(有关于通过谷歌进行此操作的文章)。
由于您正在使用MIDI in作为键盘,因此基本上只需要检测两个MIDI消息,即打开和关闭。MIDI消息是三个数据字节,指定命令、音符和速度。note off只是音符号(有时“坏”MIDI堆栈以零速度发送音符,这也是你必须预料到的)。
一旦你有了转换它们的消息,从。net输出的键盘应该相当简单。
其他答案中有很多关于技术细节的建议;我只是想让你对实际的MIDI消息有一个概念。好运!
尝试使用基于微控制器的系统,比如Arduino。
推荐文章
- 移动文本字段时,键盘出现迅速
- 电话:用于文本输入的数字键盘
- 出现键盘时,Flutter小部件将调整大小。如何预防这种情况?
- 当文本字段被选中时,滚动UITableView
- 你如何告诉如果大写锁定使用JavaScript?
- 我如何检测软件键盘在Android设备上是否可见?
- Android:当焦点在EditText上时自动显示软键盘
- 如何解散键盘的UITextView与返回键?
- 如何解除屏幕上的键盘?
- 在JS/jQuery中绑定方向键
- Android:我如何防止软键盘把我的视图往上推?
- 编辑文本聚焦时如何显示软键盘
- 运行javascript函数时,用户完成输入,而不是上键?
- 把钢琴键盘当作电脑键盘使用
- Xcode 6:键盘在模拟器中不显示