Closed truj closed 3 years ago
After changing the config defaults I found problems in a song. These can be boiled down to the following examples:
INSTRUMENTS
0 PERCUSSIVE_ORGAN PERCUSSIVE_ORGAN
END
0 c /4 d=100%
0 d,b /4
0 b /4
* tempo 95
INSTRUMENTS
0 PERCUSSIVE_ORGAN PERCUSSIVE_ORGAN
END
0 - /4
0 c /4 d=100%
0 d,b /4
0 b /4
* tempo 95
They cause different errors. Maybe caused by the same problem, maybe not. Find the problem and fix it.
Found the reason for https://github.com/truj/midica/issues/58#issuecomment-683308440. The Note-OFF tick is moved in order to be able to integrate the note into a chord. However, it has been moved to the tick of the next Note-ON of the same note. This caused an exception later because the ON tick is still in the note history but not in the ON/OFF history.
Tried to auto-correct similar issues by moving all conflicting ONs and OFFs to the same direction, without losing any of them. This avoided exceptions. However it makes the whole decompilation process much more complicated and less reliable. And the MIDI output is still not correct.
So I'll stick with the following workaround:
0 c /4
0 d /4 m
0 b /4
0 b /4
The decompilation process needs some optimizations.
EDIT:
EDIT: