m0j0hn / editor-on-fire

Automatically exported from code.google.com/p/editor-on-fire
Other
0 stars 0 forks source link

Speed Up MIDI Import #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm certain the MIDI import can be sped up significantly. I will be looking 
into this after the import code is factored out.

Original issue reported on code.google.com by xander4j...@yahoo.com on 20 May 2010 at 4:33

GoogleCodeExporter commented 9 years ago
I think the best way to speed up imports is to do fewer parses through the 
MIDI.  The
method I've been using is to use dynamic storage structures (linked lists) so 
that I
don't need to do an extra parse to determine how much storage I need.  This is a
pretty good solution to reduce the amount of file I/O (which is the the speed
bottleneck), but it adds complexity with all the extra handling of pointers.  Of
course, tasks like adding a link can be abstracted into a function, so that the 
parse
logic isn't weighted down by linked list logic.

I could probably write an "event handler" for my MIDI parsing engine to load 
all the
content for EOF.  "Event handlers" in my import logic are basically just a 
function
that is passed via pointer the parsing logic, and is called as each MIDI event 
is
parsed, so that the handler can focus on processing the data instead of parsing 
the
MIDI file.  Such an event handler would be very similar to my current lyric 
import
handler, but I would have to add support for loading notes for each instrument 
and
difficulty, as well as a few other things like Time Signatures, HOPO markers, 
etc.

Original comment by raynebc on 20 May 2010 at 5:31

GoogleCodeExporter commented 9 years ago
The slow part of my MIDI import code is actually an inefficient algorithm for 
finding 
the real-time position of events. I am only parsing the MIDI data once. I 
should be 
able to keep a current time and current BPM variable and use that to convert 
the MIDI 
delta to real time instead of starting from the beginning for each event.

Original comment by xander4j...@yahoo.com on 22 May 2010 at 4:08

GoogleCodeExporter commented 9 years ago
r172 substantially speeds up the MIDI import.

Original comment by raynebc on 24 May 2010 at 12:11

GoogleCodeExporter commented 9 years ago
After some previous edits, I'm not sure what else can be done to speed up the 
import besides processing events as they are read instead of storing them into 
arrays and then processing them after the MIDI events are parsed.  This would 
probably only provide a very small speed improvement and would make the MIDI 
parsing portion of the code more complicated.  If there's not much else to do 
for this issue, perhaps it should be closed.

Original comment by raynebc on 27 Aug 2010 at 8:03

GoogleCodeExporter commented 9 years ago
There's not really anything more to do on this issue.

Original comment by raynebc on 9 Sep 2010 at 1:36