Uses the javax.sound.midi library and a little bit of music theory knowledge. Certain quantities are given weights: things like notes in a key, length of notes, which octaves those notes are in, with ...