def make_color_score(): duration = Fraction(1, 16) pitch_fields = manifolds.etc.pitch.pitch_fields pitch_fields = [Chord(x, duration) for x in pitch_fields] score = Score([]) score.append(PianoStaff([])) piano_staff = score[0] piano_staff.extend([Staff([]), Staff([])]) treble = piano_staff[0] bass = piano_staff[1] treble.clef.forced = Clef('treble') treble.accidental.style = 'forget' bass.clef.forced = Clef('bass') bass.accidental.style = 'forget' for pitch_field in pitch_fields: treble_measure = DynamicMeasure() bass_measure = DynamicMeasure() treble_measure.denominator = 16 bass_measure.denominator = 16 for note in chordtools.arpeggiate(pitch_field): t, b = chordtools.split(note) treble_measure.append(t) bass_measure.append(b) treble_measure.breaks.line = True bass_measure.breaks.line = True treble.append(treble_measure) bass.append(bass_measure) score.rest.transparent = True score.meter.break_visibility = Function('end-of-line-invisible') score.meter.transparent = True pitchtools.make_sharp(score) label.leaf_pcs(score, color = True) score.text.staff_padding = 4 return score
def make_segmented_pitch_fields_score(bigger): duration = Fraction(1, 16) score = Score([]) score.append(PianoStaff([])) piano_staff = score[0] piano_staff.extend([Staff([]), Staff([])]) treble = piano_staff[0] bass = piano_staff[1] treble.clef.forced = Clef('treble') treble.accidental.style = 'forget' bass.clef.forced = Clef('bass') bass.accidental.style = 'forget' if bigger == 'left': segmented_pitch_fields = manifolds.etc.pitch.left_segmented_fields elif bigger == 'right': segmented_pitch_fields = manifolds.etc.pitch.right_segmented_fields else: raise ValueError for i, segmented_pitch_field in enumerate(segmented_pitch_fields): field_number = (i + 6) % 8 + 1 segment_number = 0 for segment in segmented_pitch_field: segment = Chord(segment, duration) treble_measure = AnonymousMeasure() bass_measure = AnonymousMeasure() treble_measure.denominator = 16 bass_measure.denominator = 16 for note in chordtools.arpeggiate(segment): t, b = chordtools.split(note) treble_measure.append(t) bass_measure.append(b) treble.append(treble_measure) bass.append(bass_measure) segment_letter = chr(ord('a') + segment_number) treble_measure.leaves[0].markup.up.append( r'\circle { %s-%s }' % (field_number, segment_letter)) segment_number += 1 treble_measure.breaks.line = True bass_measure.breaks.line = True score.rest.transparent = True score.meter.break_visibility = Function('end-of-line-invisible') pitchtools.make_sharp(score) label.leaf_pcs(score, color = True) score.text.staff_padding = 4 #indicator = FixedSystemsIndicator((0, 40, 80, 120), 1) #layout.apply_fixed_systems_indicator(treble, indicator) staves = StaffAlignmentOffsets(0, -12) systems = SystemYOffsets(40, 4, 1) positioning = FixedStaffPositioning(systems, staves) layout.apply_fixed_staff_positioning(treble, positioning) return score