I found this module that can create midi files.
I can play the output file using pygame mixer.music easily, but if I try to play without having to save to a file(play the object) it doesn't work, I get
pygame.error: Couldn't read from RWops
.
I tried using StringIO with no success. I get the same error above.
Does anyone one know any module that can play MIDI objects, maybe create them too?
did you remember to rewind your StringIO buffer?
I went through all the steps you did, and got the same error. Then I tracked down the RWops library at sourceforge (dated 2006) and was ready to blame it.
then after succeeding with objects in module tempfile, I tried ByteIO from module IO. They both worked, but I did a seek(0) with them before the load.
So I went back to StringIO, and did a seek(0) before the load, and success!!
Here's an edited and condensed modification of the sample from midutil: