I get why Pete's code it preferable but it looks functionally equivalent to me... looked to me like your modulo math should do the same thing in resetting on reaching the inter-accent count (ie -- every three steps)
...
My bad... lots wrong with the theory beside being incorrect. It would not compile, and it would not explain the result....
doesn't this really imply it's resetting because it's getting a start message that is...
Not sure I understand the problem... you want the accent on the third pulse?
if (accentPattern == 0)
velocity = accentVelocity; // we want it on this step
accentPattern++;
But your test...
Using filtering to pass all but the three-byte stuff appears to pass everything else so you'd only need to handle the basic messages from the controller and in the process alter the the note values on note on/off...
https://github.com/FortySevenEffects/arduino_midi_library
I think you call turnThruOff() during setup.
But then you have to pass all the other stuff manually if you want the other MIDI to pass unaffected.
Those two messages are only different from what you're expecting by the note values... are you sure it pulses middle-C (note=60)?
edit... I didn't notice they both say 'off'