I need help about MIDI files

Hello,
Can anyone tell me how to read and write into midi files and how to
play them using Pascal?

thanks