Reading MIDI packets via onboard USB-OTG host

MyNameSosig
Posts: 3
Joined: Sun Dec 15, 2024 9:17 pm

Reading MIDI packets via onboard USB-OTG host

Postby MyNameSosig » Sun Dec 15, 2024 9:43 pm

This is my first post here so if anything is incorrect let me know.

I am working on a project where I want to drive strips of WS2815 leds based on input from a digital piano. I have a ESP32-S3-WROOM-1 dev board that has USB-OTG and I would like to continuously read the input of the piano keys via MIDI. I'm still very much in the planning phase so I'm seeing if its actually feasible to do it this way, and if not, what my alternatives may be. I have very little experience working with USB so I'm not sure of where to really begin.

Are there any existing libraries/examples that could accomplish this, or would I need to write most of it from scratch? Would a USB breakout board be a better idea as opposed to the OTG port?

arjen1
Posts: 28
Joined: Sun Aug 06, 2023 4:48 pm

Re: Reading MIDI packets via onboard USB-OTG host

Postby arjen1 » Mon Dec 16, 2024 1:48 pm

Just a suggestion out of the box: Does your piano (also) have the original DIN plug Midi input/output? The MIDI protocol is just simple RS232 at a baudrate of 31250. The basics are very simple, key(note) ON, key OFF and speed (as to determine how hard you hit the key). You could use the UART for that or a software UART on any input pin.

MyNameSosig
Posts: 3
Joined: Sun Dec 15, 2024 9:17 pm

Re: Reading MIDI packets via onboard USB-OTG host

Postby MyNameSosig » Tue Dec 17, 2024 12:34 am

I cannot see any DIN I/O available. It is a Yamaha P-125, not a whole lot of functionality packed into it. So it seems like if I want to continue using this piano I would need to stick to the USB-B connection. Another idea I thought of was to use a raspberry pi to read the midi (as that would make that process a whole lot easier) and then send the data to my other esp32-s3 via SPI or something similar. I'm a bit concerned about processing speeds and syncing the boards properly with that setup however, I've never done multi-processor projects before.

lbernstone
Posts: 1132
Joined: Mon Jul 22, 2019 3:20 pm

Re: Reading MIDI packets via onboard USB-OTG host

Postby lbernstone » Wed Dec 18, 2024 7:14 pm

There is an example for how to set an esp32-s3 up to be a MIDI receiver. You should be able to get the notes from that. It doesn't have a lot of detail on how to use the info, but if you can get the events, then a bit of tinkering should get you to what you need for your Phantom of the Opera thing.

MyNameSosig
Posts: 3
Joined: Sun Dec 15, 2024 9:17 pm

Re: Reading MIDI packets via onboard USB-OTG host

Postby MyNameSosig » Thu Dec 19, 2024 3:43 am

Thank you for this, this should be enough to get me on track. I think I actually stumbled upon this example before in my research, but only glanced at it so I didn't see if it was useful enough or not.

Who is online

Users browsing this forum: Amazon [Bot], Applebot, Barkrowler and 3 guests