Bugfix: Note_off instruction was ignored and interpreted as a note_on instruction. Now is fixed and as such the sound should be improved

This commit is contained in:
simplePCBuilding
2022-03-03 14:58:36 +01:00
parent 900dc0de41
commit ee516eba68

View File

@@ -28,6 +28,8 @@ class MidiManagement:
for self.msg in self.midi_imp.tracks[self.trackn]: for self.msg in self.midi_imp.tracks[self.trackn]:
self.ext = str(self.msg) self.ext = str(self.msg)
self.note = self.ext[23:25] self.note = self.ext[23:25]
print(self.ext[0:8])
if self.ext[0:8] == "note_on ":
try: try:
self.note_height = int(self.note) self.note_height = int(self.note)
self.note_decod_oct = self.note_height // 12 self.note_decod_oct = self.note_height // 12
@@ -74,8 +76,23 @@ class MidiManagement:
except: except:
pass pass
elif self.ext[0:8] == "note_off":
print("ok")
self.ext_shortened = self.ext[40:]
self.pos = 0
for buchstabe in self.ext_shortened:
if buchstabe == "=":
self.pos += 1
break
else:
self.pos += 1
self.__output = "R"
self.__output += f":{self.pos}"
self.timing_exp = self.ext_shortened[self.pos:]
self.__output_list.append(self.__output)
else:
print("error \n")
self.addToClipboard(str(self.__output_list)) self.addToClipboard(str(self.__output_list))