Carsten Haese wrote:

On Fri, 2005-12-30 at 09:52, tim wrote:
Trying to convert midi to text using MidiToText.py.
I get the following:

midi_port: 0
Traceback (most recent call last):
 File "MidiToText.py", line 176, in ?
   midiIn.read()
File "C:\Python24\Lib\site-packages\midi\MidiInFile.py", line 24, in read
   p.parseMTrkChunks()
File "C:\Python24\Lib\site-packages\midi\MidiFileParser.py", line 167, in parseMTrkChunks
   self.parseMTrkChunk() # this is where it's at!
File "C:\Python24\Lib\site-packages\midi\MidiFileParser.py", line 129, in parseMTrkChunk
   dispatch.sysex_events(sysex_data)
AttributeError: EventDispatcher instance has no attribute 'sysex_events'


Try changing "def sysex_event(self, data):" in
...\midi\EventDispatcher.py to "def sysex_events(self, data):"

Hope this helps,

Carsten.



Yes thank Carsten! it works.
Now I am trying to generate a string or a list from the output of MidiToText instead of printing to the console. I tried simply replacing the "print" in MidiToText by "return" everywhere, and renamed it to MidiToTextFile so that I would be able to do:

for test_file in fulldir:
  f = open(test_file, 'rb')
  # do parsing
  from MidiInFile import MidiInFile
  midiIn = MidiInFile(MidiToTextFile(), f)
  f.close()
  outmidtxt.write(midiIn.read())

or something, to have the text version of several midi's written into one large textfile, but I got lost somewhere along the way....
how to do this?
...thanks again




--- Begin Message ---
Carsten Haese wrote:

On Fri, 2005-12-30 at 09:52, tim wrote:
Trying to convert midi to text using MidiToText.py.
I get the following:

midi_port: 0
Traceback (most recent call last):
 File "MidiToText.py", line 176, in ?
   midiIn.read()
 File "C:\Python24\Lib\site-packages\midi\MidiInFile.py", line 24, in read
   p.parseMTrkChunks()
File "C:\Python24\Lib\site-packages\midi\MidiFileParser.py", line 167, in parseMTrkChunks
   self.parseMTrkChunk() # this is where it's at!
File "C:\Python24\Lib\site-packages\midi\MidiFileParser.py", line 129, in parseMTrkChunk
   dispatch.sysex_events(sysex_data)
AttributeError: EventDispatcher instance has no attribute 'sysex_events'

Try changing "def sysex_event(self, data):" in
...\midi\EventDispatcher.py to "def sysex_events(self, data):"

Hope this helps,

Carsten.



Yes thank Carsten! it works.
Now I am trying to generate a string or a list from the output of MidiToText instead of printing to the console. I tried simply replacing the "print" in MidiToText by "return" everywhere, and renamed it to MidiToTextFile so that I would be able to do:

 for test_file in fulldir:
   f = open(test_file, 'rb')
   # do parsing
   from MidiInFile import MidiInFile
   midiIn = MidiInFile(MidiToTextFile(), f)
   f.close()
   outmidtxt.write(midiIn.read())

or something, to have the text version of several midi's written into one large textfile, but I got lost somewhere along the way....
how to do this?
...thanks again





--- End Message ---
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to