Write MIDI file

inside Minim library I found nice example of reading and playing MIDI file.
I was thinking to make some algoritmic MIDI generator. But I cannot find any functioonality or example how to write MIDI file using Minim or other processing library.

There I found some library called SoundCipher from processing 1.0, which is veryold and I guess not working any more.

Have you seen this one?

Aha, I overlooked it.
It seems to be dedicated to communication with external MIDI hardware (like keyborad) which is not what I need. Nevertheless, they say it can also read/write MIDI files, but I don’t see example how to do it.

In the meantime I found this example how to write MIDI directly using javax.sound.midi.*which seems rather clear. Also they say " MidiBus offers little functionality that isn’t available from Java’s native javax.sound.midi package.", so perhaps I stick to javax.sound.midi.*