实时获取MIDI设备的输入(Python) [英] Getting input from MIDI devices live (Python)
问题描述
我有一个触发手指(MIDI数位板),我希望能够实时读取其输入并根据所按的键使python执行动作.
我在Windows上需要它,最好使用python 2.5 +
谢谢
PyGame 包含内置的<一个href ="http://www.pygame.org/docs/ref/midi.html" rel ="noreferrer"> 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 Wiki中的 PythonInMusic
有许多与MIDI输入和输出有关的项目,其中一些也适用于Windows. (在每个项目之后单击小号>标记,以访问指向项目主页的链接)
我还没有亲自使用它们,但是我相信它会帮助您入门.
I've got a trigger finger (MIDI tablet) and I want to be able to read its input live and make python execute actions depending on the pressed key.
I need it for Windows, and preferably working with python 2.5 +
Thanks
PyGame includes a built-in midi module, available for Linux, Windows and MacOS and is very well supported.
For example, here is the documentation for pygame.midi.Input:
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.
If you're looking for an alternative, have a look at PythonInMusic in the Python wiki.
There are various different projects related to MIDI input and output there, some for Windows as well. (Click the little > sign after each project to follow the link to the project homepage)
I have not used any of them personally, but I'm sure it will help you get started.
这篇关于实时获取MIDI设备的输入(Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!