First, the matlab code for reading the .midi file of the song is taken from Ken Schutte.
I wrote a recursive function in matlab that plays a series of notes of a song. The function also take in parameters that can adjusts the play speed, exponential decay time of each notes, amplitude of the higher harmonics, starting time etc.
I wrote this matlab code so I can listen to the melody and know what it should sound like when I learn to play the piece using guzheng.