libtclsmf is a library for writing and (in the near future) reading standard MIDI files from within Tcl scripts. It was written for the first stage of 'oveja electrica', an experimental music composition and artificial intelligence project.