If it has to be MIDI, you could try to create soundfonts from your recorded samples and play your MIDI file using a soundfont player. I guess there are several tools you can use to create a soundfont. For example there is a tool called "Viena" on http://www.synthfont.com/.
I'm not sure if I got you right, but why do want to create the MIDI score with a programming language? Wouldn't a sequencer software do it?
I'm not sure if I got you right, but why do want to create the MIDI score with a programming language? Wouldn't a sequencer software do it?