MIDI Arpeggiator - how best to switch it off?

Started by sfzerosean, June 23, 2011, 07:26:48 PM

Previous topic - Next topic

sfzerosean

Hey all, I'm pretty far along on an arduino-based MIDI arpeggiator. You run a midi controller into this widget, then run a midi cable from the arpeggiator to the tone source of your choice, and when you play a chord it will be arpeggiated. Rate is adjustable with a knob, as is tone length (i.e. how long after a "note on" is sent is the "note off" sent).  Toggles for direction, range, hold, and whether notes are arranged in chromatic order or in the order played — this last setting combined with hold means you can make up your own arpeggiation patterns.  There's also a PANIC button that sends an All Notes Off, for when a note ends up stuck on.  I'll be posting the code etc when it's finished, or at least a little closer to finished.  Still to come: syncing to a trigger (e.g. footpedal, audio line), syncing to a midi clock (i may not deal with this one), and last but not least:

How should I turn the thing off? Or more precisely, what should the ON/OFF button do?  As far as I can think, I have two options:

- The OFF position has the micro just forward MIDI events as they are received without arpeggiating notes.
- The OFF position electrically disconnects the MIDI out port from the micro, and instead connects it to the input port (ideally using a MIDI thru amp circuit).

The first option isn't ideal because the midi library I'm using (understandably) doesn't have a "forward" function, so I think I'd need to write individual little handlers that I skipped for the arpeggiator (e.g. "when a program change is received do x", "when a pitch bend message is received do y", etc etc).  That seems like a pain, and although they'd be minuscule, it'd add latency.  On the other hand, I should arguably be forwarding messages other than note on/off anyway, and this way you could switch off the arpeggiator while it's playing without worrying about creating a stuck note.

The second option skips the hassle and latency involved in me writing an arduino middle man, but you could easily end up with a stuck note if you flip the switch at a bad time.  Just swapping a midi electrical connection also feels a little "wrong" to me, but I don't have a specific reason why (bad for the opto on the other end, maybe).


Any thoughts?  Am I overlooking a convenient third option?  Or being an idiot worrying about the downside of one of the above two?


cpm

As an ignorant on that midi thing, i dare to suggest your third option:
the off signal is sent to the cpu, which will wait until the end of a midi message (or whatever is called in this protocol) and only then switch the midi routing
probably turning on the midi processing through the cpu is a similar task: watch the midi bus until a message is finished and then swith the routing through the cpu midi output.

potul

What you describe look more like a "bypass" rather than "off". I would use the first method for one reason. When you have it plugged and "ON", I guess you would also want other messages to pass through..., otherwise you will also lose program changes etc when enabled. If you have to code it anyway, then bypass is as simple as stop "arpeggiating" and just copy the input to the output.


sfzerosean

Thanks for the replies!

Yeah, I think the second option was a bit much — it's not like there's MIDI "tone-suck" to make setting up something true-bypass-esque necessary.  So I'm going to go and set up those pass-throughs.  I have to admit, it's weird and disappointing for the pitch bend not to work (the current situation), and in any case I'm hoping this will be useful enough for other people, too.