Limiting incoming MIDI signal velocity

Hello everyone, I just wanted to know if it's possible to limit incoming MIDI signal velocity using Arduino and what would be the best board to do this.

i.e:

MIDI INPUT VELOCITY - LIMIT (set by user) - MIDI OUTPUT VELOCITY

100 - 100 - 100

78 - 100 - 78

127 - 100 - 100

I just want to apply this filter to every note on event, I'm not planning on re-routing anything.

It should be sufficient to use the hardware serial port to receive MIDI and send MIDI. Your sketch would receive the MIDI messages, recognize which byte is the velocity byte, and output the same message with the velocity adjusted.

If you want to get fancy you can use a potentiometer on an analog input pin to adjust the velocity limit on-the-fly.

I think the Arduino Pro Micro would be the best solution. It has built-in USB (for upload and debug) PLUS a spare hardware serial port (for MIDI). The Arduino Pro Mini is small but only has connectors for one hardware serial port. You need a separate USB-to-Serial board or cable to do uploading and you have to use the same port for MIDI so you can't easily get serial debug output. The Arduino Nano has an on-board USB-to-Serial adapter so you don't need an external one but that adapter uses the only hardware serial port so, again, you have to use the same port for MIDI so you can't easily get serial debug output.

The constrain command will be useful for your limiting e.g. output = constrain(input, 0, velocityLimit).

The best board may depend on whether you are going to be using classic MIDI with 5-pin DIN plugs or MIDI over USB and exactly how you plan to connect it. The Pro Micro may be a reasonable choice either way.

Steve