fix: muscriptor_dynamics.py
Browse files- muscriptor_dynamics.py +11 -8
muscriptor_dynamics.py
CHANGED
|
@@ -160,10 +160,11 @@ def read_midi(path):
|
|
| 160 |
args = body[i:i + count]
|
| 161 |
i += count
|
| 162 |
if high == 0x90 and args[1] > 0:
|
| 163 |
-
sounding
|
| 164 |
elif high == 0x80 or (high == 0x90 and args[1] == 0):
|
| 165 |
-
|
| 166 |
-
if
|
|
|
|
| 167 |
notes.append([start, tick - start, args[0], channel])
|
| 168 |
else:
|
| 169 |
if status is None:
|
|
@@ -174,14 +175,16 @@ def read_midi(path):
|
|
| 174 |
args = body[i:i + count]
|
| 175 |
i += count
|
| 176 |
if high == 0x90 and args[1] > 0:
|
| 177 |
-
sounding
|
| 178 |
elif high == 0x80 or (high == 0x90 and args[1] == 0):
|
| 179 |
-
|
| 180 |
-
if
|
|
|
|
| 181 |
notes.append([start, tick - start, args[0], channel])
|
| 182 |
|
| 183 |
-
for (channel, pitch),
|
| 184 |
-
|
|
|
|
| 185 |
|
| 186 |
tempo.sort(key=lambda item: item[0])
|
| 187 |
|
|
|
|
| 160 |
args = body[i:i + count]
|
| 161 |
i += count
|
| 162 |
if high == 0x90 and args[1] > 0:
|
| 163 |
+
sounding.setdefault((channel, args[0]), []).append(tick)
|
| 164 |
elif high == 0x80 or (high == 0x90 and args[1] == 0):
|
| 165 |
+
stack = sounding.get((channel, args[0]))
|
| 166 |
+
if stack:
|
| 167 |
+
start = stack.pop(0)
|
| 168 |
notes.append([start, tick - start, args[0], channel])
|
| 169 |
else:
|
| 170 |
if status is None:
|
|
|
|
| 175 |
args = body[i:i + count]
|
| 176 |
i += count
|
| 177 |
if high == 0x90 and args[1] > 0:
|
| 178 |
+
sounding.setdefault((channel, args[0]), []).append(tick)
|
| 179 |
elif high == 0x80 or (high == 0x90 and args[1] == 0):
|
| 180 |
+
stack = sounding.get((channel, args[0]))
|
| 181 |
+
if stack:
|
| 182 |
+
start = stack.pop(0)
|
| 183 |
notes.append([start, tick - start, args[0], channel])
|
| 184 |
|
| 185 |
+
for (channel, pitch), stack in sounding.items():
|
| 186 |
+
for start in stack:
|
| 187 |
+
notes.append([start, 0, pitch, channel])
|
| 188 |
|
| 189 |
tempo.sort(key=lambda item: item[0])
|
| 190 |
|