Skip(l) releaseVoice = breathVoice.copy() releaseVoice.invocation = "ReleaseVoice" for l in releaseVoice.leaves: l.duration.rewrite((1, 16)) l.beam.clear() l.beam.clear() l.beam.counts = None l.beam.unspan() if l.kind("Note"): l.pitch = 0 else: Skip(l) referenceVoice = breathVoice.copy() referenceVoice.invocation = "BreathReferenceVoice" for l in referenceVoice.leaves: if l.kind("Note"): l.pitch = -17 breathVoices = {"attack": attackVoice, "nucleus": nucleusVoice, "release": releaseVoice} breathStaff.pop() breathStaff.extend([attackVoice, nucleusVoice, releaseVoice, referenceVoice]) number(flutePitchVoice) # number(attackVoice) # number(nucleusVoice) number(referenceVoice)
p1Voice = find(p1Staff, 'piano-1 voice') p1Leaves = instances(p1Staff, '_Leaf') p1Staff.name = 'RH' p1Voice.name = 'RHVoice' p2Staff = staves[5] p2Voice = find(p2Staff, 'piano-2 voice') p2Leaves = instances(p2Staff, '_Leaf') p2Staff.name = 'LH' p2Voice.name = 'LHVoice' crossVoice = p1Voice.copy() crossVoice.name = 'cross voice' p2Staff.insert(0, crossVoice) p2Staff.brackets = 'double-angle' # make sure to traverse and cast first ... for l in crossVoice.leaves: Skip(l) l.beam.counts = None l.beam.unspan() #for beam in crossVoice.spanners.get(classname = 'Beam'): # beam.die() # ... and then extract leaves afterwards. crossLeaves = instances(crossVoice, '_Leaf') number(p1Staff.leaves) number(p2Staff[1].leaves)
p2range += [419] p2range += [451, 459, 469, 472, 473, 475] p2prolongations = range(112, 113 + 1) p2prolongations += range(142, 150 + 1) p2prolongations += range(283, 295 + 1) p2prolongations += range(297, 303 + 1) p2prolongations += range(307, 313 + 1) p2prolongations += range(317, 334 + 1) ct = 0 for i, l in enumerate(instances(piano2Staff, '_Leaf')): if l.kind('Note') and i in p2range: arity = p2arity[ct % len(p2arity)] l.arity = arity markup = r'_ \markup \with-color #red \fontsize #1 { %s }' % arity l.formatter.right.append(markup) ct += 1 if l.kind('Note') and i in p2prolongations: l.prolongation = True l.formatter.right.append( r'^ \markup \with-color #blue \fontsize #3 { * }') number(staves[0]) #for st in staves: # check(st) print('pickle ...') dump_pickle(staves, PERSISTENCEDIR + 'assignment.pkl')
# -*- coding: utf-8 -*- import abjad from cfg.cfg import PERSISTENCEDIR from music import find, number eighths = load_pickle(PERSISTENCEDIR + 'eighths.pkl') staves = load_pickle(PERSISTENCEDIR + 'color-1.pkl') violinPitchStaff = find(staves, 'pitches-vl staff') violinPitchVoice = find(staves, 'pitches-vl voice') bowStaff = find(staves, 'bow staff') bowVoice = find(staves, 'bow voice') bowVoice.invocation = 'BowVoice' for l in bowVoice.leaves: l.history['class'] = l.__class__.__name__ bowReferenceVoice = bowVoice.copy() bowReferenceVoice.invocation = 'BowReferenceVoice' bowStaff.append(bowReferenceVoice) for l in bowReferenceVoice.leaves: l.beam.counts = None l.beam.unspan() if not l.kind('Rest'): Skip(l) number(violinPitchVoice) number(bowVoice)
### number measures ### for staff in staves: for voice in staff: for i, measure in enumerate(voice): measure.comments.before.append("measure %s" % (i + 1)) ### remove original leaf numbering ### unnumber(staves) for leaf in instances(staves, "_Leaf"): leaf.formatter.right = [x for x in leaf.formatter.right if "blue" not in x and "red" not in x] ### apply new leaf numbering to accommodate rh split ### number(rh) number(lh) rhoctspan(734, 734, 1, 0, 6) rh.leaves[740].dynamics = "f" rh.leaves[740].articulations.append("tenuto") rh.leaves[742].articulations.append("tenuto") rh.leaves[741].pitches = [18, 26, 28] # transpose e'''' down to e''' rh.leaves[744].articulations.append("tenuto") for leaf in lh.leaves[245 : 253 + 1]: Rest(leaf) for leaf in lh.leaves[256 : 257 + 1]: Rest(leaf)