Home : Tune Toys : MIDI Mixup 
  MIDI Mixup is an interactive toy that takes three MIDI files as input and processes them to produce another MIDI file. You can specify the input files by selecting a collection from which a random file will be chosen. The pitch, channel, time, and duration of the notes in the three input files is then used to make a single new output file.

Use pitches from
Use Channel & Time from
Use Duration from
Maximize Length
 

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