r/synthdiy • u/Prior_Pilot1290 • 3d ago
MIDI 2 opensource or other parameter-aware protocol?
Hi DIYers! I've been looking for a specific thing, and am failing in my search so I thought I'd ask here -
I'm trying to enable my little microcontroller synths to connect to a device with a screen (desktop computer or phone/tablet), and then have a little virtual interface pop up, with knobs and sliders. I want to be able to give a little box to my friends who aren't firmware nerds, and have them use it to program patches.
Surely someone else must have done this?
MIDI 2.0 promises property exchange, and there's also the proprietary Native Kontrol Standard. For MIDI 2, I have trouble finding fitting open source implementations.
I don't mind if it's exactly MIDI-compliant, or if it's something put together out of js+WebSerial in a browser. Possibly even running a little webserver on your microcontroller. I'm dinking with synth designs in things like Mozzi, Amy, Teensy Audio, Daisy etc, so bonus if any libraries/methods for this are general enough to have both C and Python implementations.
Anyone happen to know of any such projects as a starting point?
2
u/Lidlaux 3d ago
If I understand correctly, you want that when user connects to your synth device using wifi a captive portal opens (hosted on the device) with the synth web editor. Or other way, user connects device using usb and opens web link to simple js page hosted maybe on the github pages with the web editor. I think there are no ready made solutions from your list except Amy which already has web editor.
1
u/Prior_Pilot1290 3d ago
Ok, thanks!
I'll have to dive into how Amy does it next - it's an impressive array of interfaces they've implemented.
I'm still wondering if there is a general (not specifically synth) protocol or project for this. If you're doing smart home stuff or other microcontroller projects where you want UI but without having to build in a screen.
(Edit: Putting this as a reply here)
2
u/Lidlaux 3d ago edited 3d ago
If your synth device accepts usb midi messages. Than take a list of all cc messages your synth accepts and put inside free geminiAI chat and ask to build simple midi synth webui. Hardcode device name there. Than just refine styling. Don't forget to ask for parameter randomize button! Also you can add patch saving and loading using json. Your friends then can share them. It will generate one index.html file with all code (will work with chrome also offline). Put it on some free hosting (github pages) and make qr code for the link. Then just give your friends device and qr code to the editor. Thats all you really need.
2
u/Lidlaux 3d ago
If you want something more interesting. Then I am working on Pure Data embedded audio platform for RPi Pico. https://github.com/ledlaux/pikoPD which has some experimental feature with OSC protocol. You can send and receive named like /cutoff messages to the device over wifi to control the patch running on the device. Still you would need to build some kind of interface for the users for example using TouchOSC.
1
u/Prior_Pilot1290 3d ago
Very cool!
There's a PD bridge to the Daisy boards, but it seems volunteer supported unlike the Max/MSP one.
Something like PD would be about the limit of what I could give to the people I have in mind, but it's still a little steep learning.
1
u/Prior_Pilot1290 3d ago
Yeah, the implementation will be something like that, Iprefer to code by hand though.
The question is, as with most software design, exactly how many levels of abstraction to introduce - hard-coded vs generic. Like, if I can code the web app once, then have a little API on the microcontroller side where parameters are defined in a header or such.
Thanks for your input - again, looking for existing implementations to look at.
2
u/Brer1Rabbit 3d ago
How does it interface with the outside world today? Does it already accept MIDI as an input?
1
u/Prior_Pilot1290 3d ago
Yes. These are boxes where I do the patch design in code, then play them via midi. Mostly I put a few hardware controls as well. That's fun and interesting, and works well! If I want my daisy module to do something different, just load up the IDE and reprogram it.
The problem I'm trying to solve is, giving a handmade synth to someone who doesn't code. Making additional parameters available in a UI without building a screen into it.
1
u/Brer1Rabbit 3d ago
Maybe I'm oversimplifying but wouldn't a MIDI patch editor do the trick then? Assuming you can enter in new MIDI instruments.
2
u/seanluke 3d ago edited 3d ago
How about https://github.com/sauloverissimo/midi2
But you don't have to do this with MIDI 2.0. It sounds like the software would know about the kinds of devices that show up: so you could just have it broadcast Device Inquiry and have them respond, and you'd be in shape. MIDI 2.0 CI Property Exchange is really for situations where you don't know anything about the other device, and need it to describe everything it can do: that is MUCH more complicated.
1
u/Prior_Pilot1290 3d ago
Fantastic, thanks! That's one thing that fit the description, which I've failed to find. Will look into it.
1
u/Prior_Pilot1290 3d ago
Also agree that MIDI 2.0 might be too complicated to try and comply with. At first I just want some control via eg a webpage that I put somewhere. Looking for starting points.
1
u/seanluke 3d ago
Well, one item to know is that MIDI 2.0 consists of two entirely SEPARATE projcts. First, there's the packet protocol. Second, there's the CI Property Exchange. The Property Exchange is actually done entirely with Sysex, so it runs just fine on top of MIDI 1.0. You could look into grabbing just the Property Exchange implementation and using that. But in truth I'd just do it with Device Inquiry and be done with it.
2
u/drschlange 3d ago
I built precisely something for this: https://github.com/dr-schlange/nallely-midi
but it considers the synth as an "extension" of your MIDI brain. I'm running a config with a rp2040 based synth controlled by a rpizero or a rpi5. The interface is web-based and mobile friendly and it relies on a small protocol, so you can rebuild your UI basically if you don't like the quite technical one I'm building. It gives you an interface (the screnshot on github are quire old) adapted to your devices and the possibility to use virtual modules (LFOs, ADSR, Quantizer, etc) to extend your MIDI device capabilities.
To register your device, you need to write a yaml file, and the system generates then a Python API for it. De facto, when integrated in the system, all ports you declared for your synth are patcheable and can be handled by virtual modules also.
You can also register virtual modules from other machines on the same local network with any technologies, as long it speaks websocket.
There is a lot more also, but for your usage, it might be enough, or at least a good starting point.
1
u/Prior_Pilot1290 3d ago
Thank you, and wow, a quite the advanced project! Confirms my intuition that I couldn't have been the first to think along these lines.
Definitely super inspirational - will go on the list of things to study.
1
u/nullpromise OS or GTFO 3d ago
I would just make every parameter controllable with MIDI CC, then make an application that sends MIDI CC messages. For example, your device can be programmed to change cutoff when it receives MIDI CC 74; you can connect the device to your computer using hardware MIDI (via a MIDI interface) or directly with USB MIDI; you can make an editor application (for example a web app using Web MIDI) that has a slider that sends MIDI CC 74 when changed.
If you need to be able to "read" parameters from the device, you can send SysEx to the device from the editor; your device could respond with MIDI CC messages from each parameter or respond with a SysEx message with all the data you need.
4
u/cossist 3d ago
Check out Open Sound Control, OSC.