I am working on a small MIDI router application for the Jack audio connection kit in Rust. The goal of this application is to route MIDI signals from an instrument to one or multiple applications in real-time based on conditions.
For example, I have a piano VST and a strings VST, and I want to control both of them simultaneously with the same MIDI keyboard. So, I could decide to send every MIDI note below C3 to the strings VST and every MIDI note above C3 to the piano. This is akin to the split keyboard common in physical keyboards. Alternatively, I also could send every signal to both VSTs simultaneously or ignore some.
I uploaded the code to GitHub and I will not change the contents of the main
branch until this topic is closed. Since this is my first project in Rust, I am grateful for any learning that I can take away from this. Performance-related issues, better design choices, readability/maintainability and best practices are of particular interest to me, but I'd also love to learn about general implementation/coding/style related issues.
I designed my (barebone) MIDI implementation based on the MIDI reference tables by the MIDI Association. My router supports routing rules based on the MIDI event type (e.g., note-on/off), channel (1-16), value, velocity and controller signal. Which conditions are available depends on the MIDI event type.
The entry point to the application is (you guessed it) in main.rs
. routing.rs
defines the actual business logic of routing MIDI signals to specific ports as defined in the routing configuration. jack_router.rs
connects this business logic with JACK and the parser
module reads the routing configuration from a text file.
The configuration file format is a custom format designed for simplicity and ease of use. I described its format in the project's README file.
If you have any questions, feel free to ask. I would like to thank you in advance for your time and look forward to gaining insights into application design, performance and any Rust-specifics.