我有一个扳机手指(MIDI 平板电脑),我希望能够实时读取其输入并使 python 根据按下的键执行操作。

我需要它用于 Windows,并且最好使用 python 2.5 +

谢谢

有帮助吗?

解决方案

PyGame 包括一个内置 MIDI模块, ,可用于 Linux、Windows 和 MacOS,并且得到很好的支持。

例如,这是以下文档 pygame.midi.输入:

  Input is used to get midi input from midi devices.
  Input(device_id)
  Input(device_id, buffer_size)
        Input.close - closes a midi stream, flushing any pending buffers.   closes a midi stream, flushing any pending buffers.
        Input.poll - returns true if there's data, or false if not. returns true if there's data, or false if not.
        Input.read - reads num_events midi events from the buffer.  reads num_events midi events from the buffer.

如果您正在寻找替代方案,请查看 Python音乐 在 Python wiki 中。

那里有各种与 MIDI 输入和输出相关的不同项目,其中一些也适用于 Windows。(点击每个项目后面的小>符号可访问项目主页的链接)

我个人没有使用过其中任何一个,但我相信它会帮助您入门。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top