comparison musiccutter.py @ 8:f07a997e9f79

Engrave filename and page number.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 02 Apr 2016 23:26:38 +1030
parents 31db42ce72b8
children e9760224e992
comparison
equal deleted inserted replaced
7:31db42ce72b8 8:f07a997e9f79
72 print ev 72 print ev
73 73
74 print 'Playable count:', playablecount 74 print 'Playable count:', playablecount
75 print 'Unplayable count:', unplayablecount 75 print 'Unplayable count:', unplayablecount
76 76
77 for svg in svgs: 77 for i in range(len(svgs)):
78 svg = svgs[i]
79 svg.add(svg.text('%s (%d / %d)' % (midifile, i + 1, npages), fill = 'black', stroke = 'black',
80 insert = ('%.3fcm' % (0), '%.3fcm' % (self.pageheight))))
78 svg.save() 81 svg.save()
79 82
80 # http://www.electronics.dit.ie/staff/tscarff/Music_technology/midi/midi_note_numbers_for_octaves.htm 83 # http://www.electronics.dit.ie/staff/tscarff/Music_technology/midi/midi_note_numbers_for_octaves.htm
81 @staticmethod 84 @staticmethod
82 def genmidi2note(): 85 def genmidi2note():
126 129
127 @staticmethod 130 @staticmethod
128 def _emitnote(svg, x, y, w, h): 131 def _emitnote(svg, x, y, w, h):
129 svg.add(svgwrite.shapes.Rect(insert = ('%.3fcm' % (x), '%.3fcm' % (y)), 132 svg.add(svgwrite.shapes.Rect(insert = ('%.3fcm' % (x), '%.3fcm' % (y)),
130 size = ('%.3fcm' % (w), '%.3fcm' % (h)), 133 size = ('%.3fcm' % (w), '%.3fcm' % (h)),
131 stroke = 'red', stroke_width = '1px', fill = 'red')) 134 stroke = 'red', stroke_width = '1px', fill = 'red'))
132 135
133 if __name__ == '__main__': 136 if __name__ == '__main__':
134 main() 137 main()