marcel-licence / esp32_basic_synth

ESP32 based simple synthesizer project
GNU General Public License v3.0
232 stars 36 forks source link

Midi via USB macro? #45

Closed MichaelPNolan closed 2 years ago

MichaelPNolan commented 3 years ago

MIDI can be received via USB activating the MACRO "MIDI_VIA_USB_ENABLED" in config.h. this is not in the sketch ... do i have to transplant the files from another module into the project?

marcel-licence commented 3 years ago

This is a preparation for the usb midi integration. Actually there is a standalone project: https://github.com/marcel-licence/esp32_usb_midi I think I will merge it soon into this project to support MIDI via usb

MichaelPNolan commented 3 years ago

Ok - i got it to work - i integrated ESP32_usb_midi into ESP32_basic_synth It was kind of not working until i put this into the midi_interface file of this project ..

void Midi_SendShortMessage(uint8_t *msg) { Serial2.write(msg, 3); }

You also have to be careful that you aren't using pins used for SPI because there are overlaps. I know you know, just saying for the purposes of this. Assuming you know because you have made all the things work together. At some point my launchpad started to show a turn on sequence when I rebooted the ESP32. Then I got printed out notes coming from the pad ... I made quite a few tweaks before this actually worked so I'm a bit confused what was the magic sauce but i have this in the loop.

Midi_Process(); //#ifdef MIDI_VIA_USB_ENABLED UsbMidi_ProcessSync(); //#endif UsbMidi_Loop();

Do I need UsbMidi_ProcessSync(); there at the top level loop?

marcel-licence commented 3 years ago

Sounds great. UsbMidi_ProcessSync is required to process incoming midi events in sync. I put them into a buffer and UsbMidi_ProcessSync gets them from the buffer. Otherwise I had a lot of trouble with midi interaction

MichaelPNolan commented 3 years ago

So a DAC arrived ... i've been going more into it with discrete components rather than the Esp32-A1S-AudioDev board. I have a pcm5102 breakout. I have USB midi calling notes and sound playing. The sound seems like its a bit of a mess - lowest notes making noise higher notes very quiet ... So I guess its time to get to mapping things and see if I can get that to work. Also to solder together the analogue inputs for your ADC module of controls.

marcel-licence commented 2 years ago

Code has been updated in the meantime