changeset 36:6874140c9c11

Fix transposition.
author Daniel O'Connor <darius@dons.net.au>
date Tue, 17 May 2016 22:30:54 +0930
parents 71d1f7a5dc3c
children c490fecec0ef
files musiccutter.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/musiccutter.py	Wed May 04 17:48:32 2016 +0930
+++ b/musiccutter.py	Tue May 17 22:30:54 2016 +0930
@@ -109,11 +109,11 @@
 
                         if note in self.note2slot:
                             slot = self.note2slot[note]
-                        elif self.trytranspose and (ev.note - 12 in self.midi2note and self.note2slot[self.midi2note[ev.note - 12]]):
+                        elif self.trytranspose and ((ev.note - 12) in self.midi2note and self.midi2note[ev.note - 12] in self.note2slot):
                             print 'Transposing note %d (%s) down' % (ev.note, note)
                             slot = self.note2slot[self.midi2note[ev.note - 12]]
                             transposedowncount += 1
-                        elif self.trytranspose and (ev.note + 12 in self.midi2note and self.note2slot[self.midi2note[ev.note + 12]]):
+                        elif self.trytranspose and (ev.note + 12 in self.midi2note and self.midi2note[ev.note + 12] in self.note2slot):
                             print 'Transposing note %d (%s) up' % (ev.note, note)
                             slot = self.note2slot[self.midi2note[ev.note + 12]]
                             transposeupcount += 1