虚拟 MIDI 和 VST
我想制作一个简单的 VST 插件来执行以下操作:
- 分析音频流(音量、节拍等...)
- 在分析器的输出上有触发器(例如,当音量 > 阈值时执行某些操作)
- 根据触发器生成 MIDI 事件
这是为了能够链接插件,即使它们不是为此设计的。 例如,我可以通过音频流的包络来控制压缩器的增益,只需将插件的 MIDI OUT 连接到压缩器增益按钮的 MIDI IN 即可。
问题是我不知道该怎么做。 VST 中是否支持像这样的直接 MIDI 连接? 或者也许我需要某种“虚拟 MIDI 设备”来互连?
I would like to make a simple VST plugin that does this :
- analyze an audio stream (volume, beat, etc...)
- has triggers on the analyzer's output (e.g. do something when volume > threshold)
- generate MIDI events based on the triggers
This is to be able to chain plugins, even if they are not designed for it. For example I could control the gain of a compressor with the envelope of an audio stream, simply by connecting the MIDI OUT of my plugin to the MIDI IN of the compressor's gain button.
The problem is I don't know how to do this. Is there support for direct MIDI connections like this in VSTs ? Or maybe I need some sort of "virtual midi device" for interconnects ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的预感可能是正确的; 通过编写虚拟 MIDI 设备而不是 VST 插件,可以更轻松地完成此任务。 可以使用 sendVstEventsToHost() 调用将 MIDI 事件发送到音序器,但问题是文档从未指定主机需要如何对这些事件做出反应。 许多主机只是忽略它们,我当然想不出一个可以轻松地从插件路由到 MIDI 通道(也许是 plogue bidule?)。
您也许可以使用带有 kAudioUnitType_Generator 插件类型的音频单元来完成此任务...虽然我从未编写过这样的插件,但我的印象是,这就是您用来为主机生成 MIDI 的插件。 但同样,这里的问题是我不确定主机如何允许您将音频路由到插件并从中接受 MIDI。
无论如何,当您想要标准化最广泛使用的定序器的行为时,作为插件实现的想法将是最难实现的。 我认为,实现您想要的目标的一种更简单的方法是创建一个虚拟 MIDI 设备,正如您已经想到的那样,然后使用重新连线将输入信号路由到您的程序。
编辑:以下是一些有关为各种系统编写 MIDI 驱动程序的资源:
Your hunch here is probably correct; this task will be easier to accomplish by writing a virtual MIDI device instead of a VST plugin. It is possible to send MIDI events to a sequencer using the sendVstEventsToHost() call, but the problem is that the documentation never specifies how the host is required to react to these events. Many hosts simply ignore them, and I certainly can't think of one which allows easy routing from a plugin to a MIDI channel (maybe plogue bidule?).
You might be able to accomplish this with Audio Units with the kAudioUnitType_Generator plugin type... though I've never written such a plugin, my impression was that this is what you'd use to generate MIDI to the host. But again, the problem here is that I'm not sure how the host would allow you to route audio to the plugin and accept MIDI from it.
At any rate, your idea implemented as a plugin will be the most difficult to implement when you want to standardize its behavior for the most widely used sequencers. I think that a far easier way to accomplish what you want is to create a virtual MIDI device, as you'd thought of already, and then use rewire to route an input signal to your program.
Edit: Here's some resources on writing MIDI drivers for various systems:
VST 插件不支持直接 MIDI 连接,它们只能有 MIDI 输入/输出端口。
不过,仍然可以做到这一点,您只需要一台支持将 MIDI 从一个插件路由到另一个插件的主机。 EnergyXT、Bidule、AudioMulch 和 Console 等模块化主机在这方面表现出色。 它们都允许音频和 MIDI 信号自由路由(除了没有反馈路径)。 但在具有更“传统”混音器风格 vst 机架的主机中也有可能。 (例如,AFAIK Reaper 会将任何 MIDI 从一个插件转发到下一个插件。)
VST plugins do not support direct midi connections, they can only have midi in/out ports.
It is still possible to do it though, you just need a host that supports routing midi from one plugin to another. Modular hosts such as EnergyXT, Bidule, AudioMulch and Console excel here. They all allow audio and midi signals to be routed freely (except no feedback paths). But it also may be possible in hosts with more 'traditional' mixer style vst racks. (For example, AFAIK Reaper will forward any midi from one plugin to the next.)
如果您想在 .NET 中构建插件,请查看 VST.NET
If you want to build your plugin in .NET take a look at VST.NET