comparison musiccutter.py @ 36:6874140c9c11

Fix transposition.
author Daniel O'Connor <darius@dons.net.au>
date Tue, 17 May 2016 22:30:54 +0930
parents 1d5dcaa3b07d
children c490fecec0ef
comparison
equal deleted inserted replaced
35:71d1f7a5dc3c 36:6874140c9c11
107 notelen = ctime - start 107 notelen = ctime - start
108 playable = True 108 playable = True
109 109
110 if note in self.note2slot: 110 if note in self.note2slot:
111 slot = self.note2slot[note] 111 slot = self.note2slot[note]
112 elif self.trytranspose and (ev.note - 12 in self.midi2note and self.note2slot[self.midi2note[ev.note - 12]]): 112 elif self.trytranspose and ((ev.note - 12) in self.midi2note and self.midi2note[ev.note - 12] in self.note2slot):
113 print 'Transposing note %d (%s) down' % (ev.note, note) 113 print 'Transposing note %d (%s) down' % (ev.note, note)
114 slot = self.note2slot[self.midi2note[ev.note - 12]] 114 slot = self.note2slot[self.midi2note[ev.note - 12]]
115 transposedowncount += 1 115 transposedowncount += 1
116 elif self.trytranspose and (ev.note + 12 in self.midi2note and self.note2slot[self.midi2note[ev.note + 12]]): 116 elif self.trytranspose and (ev.note + 12 in self.midi2note and self.midi2note[ev.note + 12] in self.note2slot):
117 print 'Transposing note %d (%s) up' % (ev.note, note) 117 print 'Transposing note %d (%s) up' % (ev.note, note)
118 slot = self.note2slot[self.midi2note[ev.note + 12]] 118 slot = self.note2slot[self.midi2note[ev.note + 12]]
119 transposeupcount += 1 119 transposeupcount += 1
120 else: 120 else:
121 unplayablecount += 1 121 unplayablecount += 1