In whichever language you choose to write the functions, you're going to have to read a file in byte by byte, following the specification exactly, and storing all the information internally.
Once you have all the information (or as you're getting it), you can start to set things up, like maybe loading the synth sounds (or the MIDI equivalent).
From there, it should be a simple matter of following the data for how to play the sounds (which should include a frequency and length I believe).
If you can, have a look at an open-source MIDI player, that should give you a good idea on how to go about it.