Show HN: Windows 完美蓝牙 MIDI 支持
3 分•作者: mayerwin•大约 2 小时前
大家好,我是 Erwin。我开发了一个小巧、免费的开源实用程序,可以将蓝牙 LE MIDI 键盘桥接到新的 Windows MIDI Services 堆栈中,这样任何 DAW 或 Web MIDI 应用程序都可以像使用有线键盘一样使用它们。<p>我购买了一台 Roland FP-90X 钢琴,部分原因在于它具有蓝牙 MIDI 功能。在我的 Windows 11 电脑上,配对成功了,但我的 DAW 无法识别键盘,而且我从电脑发送的音符也从未让钢琴发出声音。经过了令人沮丧的无数个夜晚,我将这个问题分解为三个相互叠加的独立错误。<p>第一个是众所周知的:Windows 仅通过 WinRT API 本地公开 BLE-MIDI,而几乎没有 DAW 轮询它。因此,即使配对成功,MIDI 应用程序仍然无法看到该设备。通常的解决方法是 MIDIberry + loopMIDI,但在我的情况下,我无法让这种组合可靠地工作,而且我想要一个单一的应用程序解决方案。新的 Windows MIDI Services 堆栈附带了一个名为环回端点的功能:写入一个端点的任何内容都会从另一个端点输出,并且任何 winmm/WinRT/WMS 应用程序都会将其视为正常的 MIDI 端口。因此,该应用程序执行 WinRT BLE-MIDI 输入,WMS 环回输出。这解决了方向一,钢琴到电脑。<p>方向二,电脑到钢琴,仍然无法工作。NoteOn 写入被 ATT-acked,但钢琴保持静音。我尝试了两种写入模式(一些 BLE-MIDI 固件会默默地丢弃其中一种),并探测了专有的 ISSC 特性。每个变体都被 ATT-acked,每个变体都产生静音。所以字节已经到达了钢琴。GATT 层之上的某些东西正在丢弃它们。<p>在排除了配对、加密、写入模式和专有特性之后,唯一明显的选择就是 MIDI 通道本身。FP-90X 有一个名为“发送通道”的面板设置,默认为 1。但事实证明,FP-90X 实际上在通道 4 上接收(并且无法更改)。我在通道 1 上发送的音符被 GATT-acked,并在合成器引擎处被默默地丢弃,因为它们不在引擎正在监听的通道上。在任何层都没有反馈。修复必须存在于应用程序层,所以我添加了一个“检测”按钮,该按钮在每个通道上从 1 到 16 播放 N 个测试音符:您数一下您实际听到的音符,该数字就是接收通道。每个 BLE MAC 保存,大约 75 秒,每个钢琴永远完成。<p>技术栈:.NET 10,Avalonia 用于 UI(BLE/MIDI 方面仅限 Windows,但 UI 层是可移植的),Microsoft.Windows.Devices.Midi2 包用于 WMS,Windows.Devices.Midi (WinRT) 直接用于 BLE,而不是依赖于 Korg 较旧的 WinMM 驱动程序。MIT 许可,单个自包含的 ~21 MB 可执行文件,没有安装程序,没有遥测,没有帐户。<p>我为自己构建了它,并将其与我的 FP-90X 一起使用,通过几个应用程序和 Web MIDI 网站进行演奏。来自 Microsoft Windows MIDI Services 团队的 Pete 在我将其分享到 r/synthesizers 时对 BLE 集成给予了积极评价(<a href="https://www.reddit.com/r/synthesizers/comments/1szvuiq/comment/oj5ew9b/" rel="nofollow">https://www.reddit.com/r/synthesizers/comments/1szvuiq/comme...</a>)。<p>网站(带截图):<a href="https://mayerwin.github.io/Perfect-Bluetooth-MIDI-For-Windows/" rel="nofollow">https://mayerwin.github.io/Perfect-Bluetooth-MIDI-For-Window...</a>
源代码:<a href="https://github.com/mayerwin/Perfect-Bluetooth-MIDI-For-Windows" rel="nofollow">https://github.com/mayerwin/Perfect-Bluetooth-MIDI-For-Windo...</a>
详细的技术文章,包含完整的调试故事:<a href="https://dev.to/mayerwin/why-your-bluetooth-midi-keyboard-silently-drops-notes-on-windows-2i84" rel="nofollow">https://dev.to/mayerwin/why-your-bluetooth-midi-keyboard-sil...</a><p>仅使用我的 FP-90X 进行了个人测试。BLE 方面是通用的,因此其他键盘(WIDI Master、CME、Yamaha MD-BT01、Korg microKey Air、ROLI Seaboard 等)应该可以工作,但我尚未单独确认。非常欢迎设备测试报告、问题和 PR。
查看原文
Hi HN, I'm Erwin. I built a small free open-source utility that bridges Bluetooth LE MIDI keyboards into the new Windows MIDI Services stack so any DAW or Web MIDI app can use them as if they were wired.<p>I bought a Roland FP-90X piano partly because it had Bluetooth MIDI. On my Windows 11 PC, pairing succeeded, but my DAW couldn't see the keyboard, and notes I sent from the PC never made the piano sing. After a regrettable number of evenings, I'd separated this into three independent bugs stacked on top of each other.<p>The first one is the famous one: Windows only natively exposes BLE-MIDI through the WinRT API, which almost no DAW polls. So even when pairing succeeds, MIDI apps still don't see the device. The usual workaround is MIDIberry + loopMIDI, but I couldn't get that combination to work reliably in my case, and I wanted a single-app solution. The new Windows MIDI Services stack ships with a feature called loopback endpoints: anything written to one comes out the other, and any winmm/WinRT/WMS app sees them as normal MIDI ports. So the app does WinRT BLE-MIDI in, WMS loopback out. That solved direction one, piano to PC.<p>Direction two, PC to piano, still didn't work. NoteOn writes were getting ATT-acked, but the piano stayed silent. I tried both write modes (some BLE-MIDI firmware silently drops one or the other), poked the proprietary ISSC characteristic. Every variant ATT-acked, every variant produced silence. So the bytes were reaching the piano. Something above the GATT layer was discarding them.<p>After ruling out pairing, encryption, write-mode, and proprietary characteristics, the only obvious lever left was the MIDI channel itself. The FP-90X has a panel setting called Transmit Channel, default 1. Yet it turns out the FP-90X actually receives on channel 4 (and it can't be changed). Notes I sent on channel 1 were being GATT-acked and silently dropped at the synth engine because they weren't on the channel the engine was listening to. Zero feedback at any layer. The fix had to live up at the application layer, so I added a Detect button that plays N test notes ascending on each channel from 1 to 16: you count the notes you actually hear, and that number is the receive channel. Saved per BLE MAC, about 75 seconds, done forever per piano.<p>Tech stack: .NET 10, Avalonia for the UI (the BLE/MIDI side is Windows-only but the UI layer is portable), Microsoft.Windows.Devices.Midi2 packages for WMS, Windows.Devices.Midi (WinRT) directly for BLE rather than relying on Korg's older WinMM driver. MIT, single self-contained ~21 MB exe, no installer, no telemetry, no account.<p>I built it for myself and use it with my FP-90X to play through a few apps and Web MIDI sites. Pete from the Microsoft Windows MIDI Services team commented positively on the BLE integration when I shared it on r/synthesizers (<a href="https://www.reddit.com/r/synthesizers/comments/1szvuiq/comment/oj5ew9b/" rel="nofollow">https://www.reddit.com/r/synthesizers/comments/1szvuiq/comme...</a>).<p>Site (with screenshots): <a href="https://mayerwin.github.io/Perfect-Bluetooth-MIDI-For-Windows/" rel="nofollow">https://mayerwin.github.io/Perfect-Bluetooth-MIDI-For-Window...</a>
Source: <a href="https://github.com/mayerwin/Perfect-Bluetooth-MIDI-For-Windows" rel="nofollow">https://github.com/mayerwin/Perfect-Bluetooth-MIDI-For-Windo...</a>
Long-form technical writeup with the full debugging story: <a href="https://dev.to/mayerwin/why-your-bluetooth-midi-keyboard-silently-drops-notes-on-windows-2i84" rel="nofollow">https://dev.to/mayerwin/why-your-bluetooth-midi-keyboard-sil...</a><p>Personally tested with my FP-90X only. The BLE side is generic, so other keyboards (WIDI Master, CME, Yamaha MD-BT01, Korg microKey Air, ROLI Seaboard, etc.) should work, but I haven't confirmed individually. Device test reports, issues, and PRs very welcome.