Home : Tune Toys : Pieces-O-MIDI 
  Pieces-O-MIDI is an interactive toy which takes one MIDI file as input and processes it to produce another MIDI file. You specify a MIDI file to use as input, along with the number of pieces into which the it should be split. Those pieces are then "re-sequenced" by using the values of the notes in the same MIDI file.

Step 1 Select a MIDI file collection, from which a midi file will be automatically and randomly selected:
Provide the URL of a MIDI file:
Step 2 These parameters control how the file will be processed.
# of pieces: Offset: Multiplier:
Step 3

The algorithm for Pieces-O-MIDI is written in KeyKit, and here's the source code.