[PATCH 0/2] Optimize processing of traditional MIDI

Werner Almesberger werner at almesberger.net
Fri Dec 2 15:38:00 EST 2011

The following two patches implement an improvement we've discussed
on #milkymist a while ago: they move the handling of MIDI bytes from
Flickernoise down into the MIDI interrupt handler of RTEMS. This
reduces the CPU (LM32) overhead when using traditional (1) MIDI.

For example, when running  "Fvese - The Tunnel (Final Stage Mix).fnp"
(which doesn't use MIDI), we normally get about 24 +/- 0.03 FPS,
which is the frame rate Milkymist generally tries to maintain.

When adding MIDI traffic of a nominal (2) 1000 messages per second,
the average frame rate drops to a mere 15.44 +/ 0.12 FPS. Such rate
changes can be quite noticeable because they change the rhythm of
the pattern the patch creates.

Short bursts of MIDI messages arriving at a high rate occur when
rapidly moving a slider, joystick, or sweeping over a touch pad.

(1) That is, MIDI using the DIN connectors. USB-MIDI and
    MIDI-over-OSC are not affected.

(2) At least a rate of 1000 messages per second is what I asked
    midigen to generate. I didn't check how much really got out.
    midigen lives here:

Note that, since these patches change the protocol on /dev/midi,
both RTEMS and Flickernoise need to be updated.

- Werner

More information about the discussion mailing list