eh2k / squares-and-circles

squares-and-circles is an alternate firmware for the Eurorack module O_C, targeting Teensy 4.
https://eh2k.github.io/□●/
166 stars 12 forks source link

compiling for USB midi #5

Closed oldmanfury closed 2 years ago

oldmanfury commented 2 years ago

If possible, can you try to compile a hex file to enable usb-midi? (I tried, ran into some errors, and realized this is way beyond me at this point).

Motivation: I made a USB breakout-panel using a Synthrotek power-PAK. Being able to use square-and-circles with the monome-teletype via I2C2MIDI would be phenomenally powerful, and would clean-up a bunch of patch-cables.

eh2k commented 2 years ago

Hello @oldmanfury,

I have played around a bit with usb_midi. Since I don't have any other usb-host devices besides my laptop, I tested it a bit with VCV. Works actually so far quite well.

You can have a look at the code in midi.cxx in the dev branch. I have redesigned the MidiHandler a bit - if I don't find any other problems, the changes will be transferred to the main branch at the next opportunity. I'm not sure yet if I want to support usb_midi in general in the future.

Here are a few more hints:

oldmanfury commented 2 years ago

Works like a charm! Having the USB midi enabled is so powerful, I'm able to write scripts on the monome teletype addressing all four engines. Teletype i2c2midi module is a host, so it is a direct-connection. Very cool!

oldmanfury commented 2 years ago

Having much fun with this. Found a bug, it seems. Set up squares and circles four engines for midi ch1,2,3,4. Play notes via a sequencer to each of those channels, and CH1 doesn't respond. I can't get all four channels to respond at once - in fact if I choose arbitrary channels like 5,6,7,8 it kind of flips out (hung note loud noises). Could you add MIDI CC's as modulation sources at some point?

eh2k commented 2 years ago

I suspect that somehow there is not a follow NoteOff message for every NoteOn. As a result, > 4 incoming NoteOns are ignored. See NoteOn/NoteOff methods in the midi.cxx.

oldmanfury commented 2 years ago

I tried using midi-ox since it has an event window I can really monitor what I've sent the SQ&CIRC. It is behaving really oddly with different midi channels on each engine. Just cannot get all four to respond - usually it is output A that is completely incommunicado. The problem isn't just missing note-offs (hanging notes).

jaxoncute commented 2 years ago

@oldmanfury - any chance you can post the .hex to load with Teensy? I'm no programmer at all but big Elektron fan and this firmware looks awesome!

Also, any tips on which OC firmware has the most FX options? I love hemispheres for the dual functionality but miss my super disting sometimes for the dual FX options. Thank you

eh2k commented 2 years ago

@jaxoncute I assume you can't connect the devices directly via USB, or can the new Elektron devices function as USB hosts? I assume you are also using a computer/overhub here?

eh2k commented 2 years ago

I tried using midi-ox since it has an event window I can really monitor what I've sent the SQ&CIRC. It is behaving really oddly with different midi channels on each engine. Just cannot get all four to respond - usually it is output A that is completely incommunicado. The problem isn't just missing note-offs (hanging notes).

@oldmanfury I gues the issue is in the NoteOn,NoteOff,process methods in the midi.cxx. Maybe the /src/stmlib/algorithms/note_stack.h is the solution.

jaxoncute commented 2 years ago

@eh2k I was just hoping to find a .hex so I could install this MachineDrum style firmware to O&C with ease. I'm not much of a techy at all so I'm used to using Teensy when swapping firmware and couldn't find a hex. It sounded like @oldmanfury had created one.

eh2k commented 2 years ago

@jaxoncute - the firmware is still work-in-progress. You can find the latest firmware builds here https://github.com/eh2k/squares-and-circles/actions, any feedback is welcome.

eh2k commented 2 years ago

Close - Midi-USB is available in RC_0.0k. Files of interest: