python 标准输入设备,实时获取MIDI设备的输入(Python)

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值