以编程方式配置Mac OS X MIDI [英] Configure Mac OS X MIDI programmatically

查看:79
本文介绍了以编程方式配置Mac OS X MIDI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个将OSC转换为MIDI的程序,从而允许启用OSC的应用程序(如iPhone上的touchOSC)来控制启用MIDI的应用程序(Sibelius,Ableton Live等).

I'm writing a program that converts OSC into MIDI, allowing OSC enabled applications (like touchOSC on my iPhone) to control MIDI enabled applications (Sibelius, Ableton Live and so on).

我正在使用Python创建OSC服务器并将OSC转换为MIDI.为了使MIDI进入相关应用程序,我正在将MIDI输出至Apple IAC驱动程序,然后将其作为相关程序中的输入启用.

I'm using Python to create an OSC server and convert from OSC to MIDI. To get MIDI to the application in question, I'm outputting MIDI to the Apple IAC driver, which is then enabled as an input within the program in question.

有人知道以编程方式配置Mac MIDI设备的方法吗?特别是,我需要启用IAC驱动程序,该驱动程序默认情况下处于禁用状态.

Does anyone know of a means to programmatically configure Mac MIDI devices programmatically? In particular, I need to enable the IAC driver, which is disabled by default.

使用FileMon,我发现启用/禁用IAC驱动程序时Audio Midi Setup.app会修改此文件:

Using FileMon, I have observed that Audio Midi Setup.app modifies this file when enabling/disabling the IAC driver:

〜/Preferences/ByHost/com.apple.MIDI.0017f2cxxxxx.plist

~/Preferences/ByHost/com.apple.MIDI.0017f2cxxxxx.plist

数字0017f2cxxxxx是我的系统IOPlatformUUID.这是一个简单的XML属性列表,但是我对直接写它很谨慎.即使我做到了,大概我还是需要哄骗Midi服务器进程以某种方式重新读取它?

The number 0017f2cxxxxx is my system IOPlatformUUID. It's a simple XML property list, but I'm wary of writing to it directly. Even if I did, presumably I would need to cajole the midi server process into re-reading it somehow?

最后,我越来越意识到,完全使用IAC驱动程序是一个非常简单的解决方案-首先,它仅适用于Mac!理想情况下,我将编写一个回送MIDI驱动程序,我的所有问题都将得到解决...

Finally, I'm becoming more and more aware that using the IAC driver at all is a pretty naff solution - for a start it only works on Mac! Ideally, I would write a loopback MIDI driver and all my problems would be solved...

推荐答案

关于直接写入plist的直觉是正确的-您可能不应该这样做.我对此不太确定,但是我有一种感觉,plist反映了MIDI设备的状态,但是更改它不会按照您的需要打开或关闭该MIDI设备.

Your hunch about writing directly to the plist is correct -- you probably shouldn't do it. I'm not 100% sure about this, but I have a feeling that the plist reflects the state of the MIDI device, but altering it will not open or close that MIDI device as you need.

要真正打开MIDI设备,您可以使用 pygame 之类的东西.我已经将其用于一些与音频相关的项目,并且该SDK非常简单易用.由于python不直接支持MIDI,因此这可能是您最好的选择(除非自己编写python C模块,否则会很痛苦).

To actually open the MIDI device, you could use something like pygame. I have used it for some audio-related projects, and the SDK is very straightforward and easy to work with. As python doesn't have great support for MIDI directly, this is probably your best bet (short of writing the python C module yourself, which would be rather painful).

对于IAC,其他操作系统没有这样的虚拟MIDI设备是很遗憾的.IAC非常有用,并且擅长于此.因此,尽管依靠IAC进行跨平台的操作不是跨平台的,但您可以编写一个抽象层来处理回送设备.对于Windows用户,您可以推荐与软件一起使用的免费MIDI回送设备.

As for IAC, it's a shame that other OS's don't come with virtual MIDI devices like this. IAC is very useful and good at what it does. So while relying on IAC for something like this would not be cross-platform, you could write an abstraction layer for manipulating the loopback device. For Windows users, you could recommend a free MIDI loopback device to be used with your software.

这篇关于以编程方式配置Mac OS X MIDI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆