AnotherJohnH / picoX7

Software simulation of the Yamaha DX7 with a MIDI interface for the Raspberry Pi Pico
MIT License
21 stars 2 forks source link

USB MIDI in (USB host mode) #4

Open probonopd opened 3 months ago

probonopd commented 3 months ago

It would be nice to have a USB MIDI in so that we can attach USB MIDI controllers (keyboards) that do not have a DIN-style MIDI connector. For this, the Pico would need to run in USB host mode.

AnotherJohnH commented 3 months ago

A blocker for this is I use my own SDK "Platform" that does not have USB host support.

Two solutions...

  1. Port picoX7 to another raspberry Pi Pico SDK that already has USB host support. All the hardware dependencies are deliberately kept to just picoX7.cpp which should help.
  2. Add USB host support to the "Platform" SDK.

TBH I'm not going to do 1. but do have a USB MIDI controller that is nicer than my actual MIDI controller. I'll have a look at the rp2040 dataset to see what's involved in adding support for USB host mode.

AnotherJohnH commented 3 months ago

... ah yes the world of USB has not simplified itself since I last visited many years ago!

But be e a good challenge and would open up some interesting possibilities for other RPi-Pico based projects.

AnotherJohnH commented 3 months ago

Currently attempting to add USB device support as a precursor to adding USB host support. If successful this should provide an easy way to control the picoX7 as a MIDI slave from a DAW. But as you state USB host support would allow direct connection to a USB-MIDI controller.

USB is complicated and MIDI-over-USB a whole other complication on top of that, so this may take a while and I might run out of enthusiasm.

However currently have the picoX7 appearing as a low level USB device, which is a good start.

mwedmark commented 3 months ago

Shortcut, steal with pride: https://github.com/diyelectromusic/picodexed/tree/main/src

AnotherJohnH commented 3 months ago

Some small progress, picoX7 now seems to work to some degree as a proper MIDI IN device. as of patch Code is provisional and needs refinement. Timing seems "lumpy"

probonopd commented 3 weeks ago

So you attach a MIDI controller (keyboard) using a USB OTG adapter cable to the USB jack on the RPi Pico, and power the RPi Pico via pins GND and VBUS?

AnotherJohnH commented 3 weeks ago

Sorry (again) should have been clearer with my "seems to work" comment. MIDI in works but only as a USB device not as a USB host. i.e. MIDI out from my laptop over USB to the picoX7 works.

probonopd commented 3 weeks ago

Thanks for the clarification. Do you plan to add USB host mode as well eventually?

AnotherJohnH commented 3 weeks ago

Yep, hope to, but my current priority is to add support for the Pico-2 and the Pimoroni pico Audio.

mwedmark commented 3 weeks ago

Sound great! I just bought a Pico2 and have the bigger brother picodemo so that combination would be cool to try. I guess that extra processing power will get many more tones poly. Maybe even support with 2 instances would be possible? ;-)

probonopd commented 13 hours ago

Possibly https://github.com/rppicomidi/midi2usbhost/tree/main/C-Code could be helpful? It is C code that does what we need.