Converting midi tracks into array of notes. Needs refactoring