A MIDI to Bluetooth Low Energy bridge written in C# running on Linux using .Net Core. cIt uses the BlueZ protocol stack to communicate with the Bluetooth device on your machine. BlueZ exposes the required functionality via D-Bus. Access to D-Bus has been simplified and modernised (async model) by Tmds.DBus.
The goal is to access a USB midi device on one side and expose it on the other via BTL, creating a bridge.
For now, I'm simply documenting my own setup to get things working. Hopefully I can make this more generic in future.
- The system runs on Ubuntu 1604.
- USB interface to Midi.
- Using a laptop with Bluetooth built in or a dongle. Mine is a System76 laptop.
Follow the instructions in the installation guide
- Communicate with BlueZ via D-Bus
- Get a basic GATT advertisement working
- Advertise remaining GATT service properties
- Create a BLE service
- Register MIDI BLE service the mimics Yamaha device
- Send a basic MIDI message (keep alive?)
- Figure out timing/resolution
- How to break "package" multiple midi messages as per the spec
- Figure out how to read MIDI messages from USB port
- Map incoming midi to outgoing midi
- Filter out stuff you don't want to see
- Enumerate devices - disconnect if we find it's already connected (can't advertise otherwise)
- Better encapsulation/classes for MIDI
- Better abstraction for filtering
- Refactor properties out of DBus interfaces