diff musiccutter.py @ 39:86622ba474e4

add some comments
author Daniel O'Connor <darius@dons.net.au>
date Mon, 23 May 2016 22:38:27 +0930
parents 9e8ed92b477c
children 5c47f9361d93
line wrap: on
line diff
--- a/musiccutter.py	Mon May 23 22:35:44 2016 +0930
+++ b/musiccutter.py	Mon May 23 22:38:27 2016 +0930
@@ -104,6 +104,7 @@
                     channels[ev.channel][ev.note] = ctime
             elif ev.type == 'note_off' or (ev.type == 'note_on' and ev.velocity == 0):
                 if ev.note not in channels[ev.channel]:
+                    # These can be rests (iWriteMusic)
                     print 'note_off with no corresponding note_on at %.1f sec for channel %d note %d' % (ctime, ev.channel, ev.note)
                     continue
                 else:
@@ -133,6 +134,7 @@
             print 'Transpose down:', stats.transposedowncount
             print 'Transpose up:', stats.transposeupcount
 
+        # Do per-page things
         for pindx in range(npages):
             pdf = pdfs[pindx / self.pagesperpdf] # PDF for this page
             # Offset into PDF where the page starts
@@ -185,11 +187,13 @@
 
         return slot
 
+    # Check if the organ can play the note
     def transposenote(self, evw, amount):
         evw.ev.note += amount
         evw.notename = self.midi2note[evw.ev.note]
         evw.slot = self.note2slot[evw.notename]
 
+    # Work out which slot to use for the note, transpose if desired
     def getslotfornote(self, evw, stats, ctime):
         evw.slot = None
         evw.notename = None