I have continued doing research on Markov-chain algorithm composition this week.
Base on the open resource on line, I did understand the basic rule of his script and also figured out some main reasons that would make his composition better.
Separate right hand and left hand midi track(analysis chord from melody)
Separate music into INTRO, VERSE, CHORUS, BRIDGE
Move all midi score into C major scale for data statistic
Generate key and tempo for the score
Since this script can only collect database from one midi score, I will need to figure out how to collect database from numerous midi score and also where I can get those scores.