在C#中发送MIDI SYSEX消息

发布于 2025-01-21 16:59:11 字数 303 浏览 0 评论 0原文

我正在尝试弄清楚如何在单击按钮时发送一个简单的Winform应用,该应用程序发送SYSEX MIDI消息,所以按钮1发送: -

F0 7F 22 02 50 01 31 00 31 00 31 F7

按钮2发送:

F0 7F 22 02 50 01 32 00 31 00 31 F7

依此类推...

我能够找到很多信息关于发送笔记和仪器数据,但与Sysex并不是什么。我玩过Sanford参考文献,这似乎使我更加接近,但对Sysex的用法仍然没有。

I'm trying to figure out how to make a simple Winform app that sends a SysEx MIDI message when I click a button, so button 1 sends:-

F0 7F 22 02 50 01 31 00 31 00 31 F7

Button 2 sends:

F0 7F 22 02 50 01 32 00 31 00 31 F7

and so on...

I was able to find lots of info about sending notes and instrument data but nothing really about sysex. I have played with the Sanford reference which seemed to get me closer but still nothing about Sysex usage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

星光不落少年眉 2025-01-28 16:59:11

有各种MIDI库可用,大多数以一种或另一种形式支持SYSEX。我主要使用 管理> manded-midi 尽管我' VE之前使用了Sanford套餐。

至少在托管中间中,发送SYSEX消息与获取imidioutput(通常来自MidiaCcessManager)一样简单,然后调用send> send方法。例如:

// You'd do this part just once, of course...
var accessManager = MidiAccessManager.Default;
var portId = access.Outputs.First().Id;
var port = await access.OpenOutputAsync(portId);

// You'd port this part in your button click handler.
// The data is copied from the question, so I'm assuming it's okay...
var message = new byte[] {
    0xF0, 0x7F, 0x22, 0x02, 0x50, 0x01,
    0x31, 0x00, 0x31, 0x00, 0x31, 0xF7 };

port.Send(message, 0, message.Length, timestamp: 0);

There are various MIDI libraries available, and most support SysEx in one form or another. I've mostly used the managed-midi package although I've used the Sanford package before.

In managed-midi at least, sending a SysEx message is as simple as obtaining an IMidiOutput (usually from a MidiAccessManager) and then calling the Send method. For example:

// You'd do this part just once, of course...
var accessManager = MidiAccessManager.Default;
var portId = access.Outputs.First().Id;
var port = await access.OpenOutputAsync(portId);

// You'd port this part in your button click handler.
// The data is copied from the question, so I'm assuming it's okay...
var message = new byte[] {
    0xF0, 0x7F, 0x22, 0x02, 0x50, 0x01,
    0x31, 0x00, 0x31, 0x00, 0x31, 0xF7 };

port.Send(message, 0, message.Length, timestamp: 0);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文