It looks like the MKR ZERO does not support USB MIDI. I can compile the script for another MCU but selecting the MKR ZERO I get compile errors. Arduino MIDIUSB library does not mention those devices.
A lot of Arduino boards have a microcontroller that interfaces with a computer via serial and often have a USB serial interface chip. This can only operate as a serial interface (RS232-like) and present as themselves, expecting the OS to have the suitable driver. They can’t pretend to be class compliant USB MIDI interface. Only a few devices with native USB interfaces can be programmed such.
If / when you find a board that does work you will have the challenge that you can’t flash new firmware to the board when it is programmed as class-compliant USB-MIDI. Some (most?) Arduino boards with USB use a separate chip to implement USB interface. Many use dedicated USB-serial adapters which won’t work here whilst others use a second microcontroller which can have it’s firmware flashed, changing it between USB-Serial and USB-MIDI. You have to reflash the interface chip before updating your core script then reflash the interface chip to get USB-MIDI back. An alternative is to use chip programmer hardware but that requires extra hardware. (You can use another Arduino as a ISP). Some boards have a DFU mode that you can trigger during initial boot allowing the serial port to be enabled for programming. This is implemented in the chip’s bootloader firmware.
Those USB power-only cables should be forbidden… Manufacturing or selling or even giving one of them should be punishable by prison…
I don’t see any reason why an electric cigarette or a ladyshave should use such kind of plug…
Standardisation ? So that we don’t need a specific cable for them… ok but their cable can’t be used for cellphones or data storage, so dwe factly need another cable for that… so it’s fake standardisation which in the end, leads to errors and hours of wondering why it doesn’t work…
I wonder how many people sent their machine, whatever it could be, to the bin, persuaded that it was faulty and not working, when the reason was simply that they used the wrong cable which looks exactly like the right one…
“She looks like the real thing, tastes like the real thing…”
Maybe @wyleu can devise a torture device using suboptimal USB cables… hanging deviants by their ankles from the battlements.
I have ordered some more STM32 development boards which might be purposed for USB MIDI. I am quite interested in this 15x15 MIDI router, processor, USB interface. Of course the code that @wyleu found should work on these boards too but seen to give a compilation warning. I will check it out when my new toys arrive in a few days.
Okay - let’s see what we can do . I reckon your MKR Zero should work as it is a SAMD which is listed as supported but it doesn’t. You could try reporting to the relevant projects to see if they can help. In the meantime we can pool our resources and see if any of us get something similar working. As @Jtunes says, the Teensy seems to do USB MIDI quite well and I expect to get the STM32 working when it arrives. (Teensy is somewhat more expensive!)
I haven’t read it but this site describes how to get USB MIDI working on a MKR Zero.
[Edit] I just tried the examples from USBMIDI and they compile for the MKR Zero. Give it a bash. You should be able to get the USB MIDI bit working. You can then either craft your own interface to the hardware sensors or integrate an existing library. That is the easy bit
I can confirm that the teensy is both easy to reprogram and easy to become a midi class compliant controller too. My ‘orange box’ uses one and even I struggled to screw it up.
and it compiled! albeit with three warnings about
warning: narrowing conversion of ‘(int)(176 | ((unsigned char)((int)channel)))’ from ‘int’ to 'uint8_t A ‘c’ case crisis from long forgotten memories. . .
So we is doing MIDI over USB to a Raspberry Pi4 … now do we know any Pi4 softwares that can make useful advantage of such a rig…?
Now I can hear the clammering shouts for a touch of so I plugged it into zynthian-amp2.local that was still sulking form having it’s Roland A88 note keyboard removed…
so here we go …
and for the real pedants ( you know who you are…)
Here it is as a MIDI recording…
Pedalboard developments have been on hold while I fixed the All-In-One board issues … But that’s working now, and I’ve got the breadboarded MKR-ZERO, Control_surface https://github.com/tttapa/Control-Surface running with 3 hall effect sensors and it’s really painless. Very impressive piece of software.
Just needed to add the invert statements into the button definition setups to invert the polarity to deal with the sensors switching high when activated.