def __illustrate__(self, markup_direction=enums.Up, figure_name=None, **keywords): """ Illustrates segment. Returns LilyPond file. """ import abjad notes = [] for item in self: note = abjad.Note(item, Duration(1, 8)) notes.append(note) markup = None if self._equivalence_markup: markup = self._equivalence_markup if isinstance(figure_name, str): figure_name = abjad.Markup(figure_name) if figure_name is not None: markup = figure_name if markup is not None: direction = markup_direction markup = abjad.new(markup, direction=direction) abjad.attach(markup, notes[0]) voice = abjad.Voice(notes) staff = abjad.Staff([voice]) score = abjad.Score([staff]) score.add_final_bar_line() abjad.override(score).bar_line.transparent = True abjad.override(score).bar_number.stencil = False abjad.override(score).beam.stencil = False abjad.override(score).flag.stencil = False abjad.override(score).stem.stencil = False abjad.override(score).time_signature.stencil = False string = r"\override Score.BarLine.transparent = ##f" command = abjad.LilyPondLiteral(string, "after") last_leaf = abjad.select(score).leaves()[-1] abjad.attach(command, last_leaf) moment = abjad.SchemeMoment((1, 12)) abjad.setting(score).proportional_notation_duration = moment lilypond_file = abjad.LilyPondFile.new(music=score) if "title" in keywords: title = keywords.get("title") if not isinstance(title, abjad.Markup): title = abjad.Markup(title) lilypond_file.header_block.title = title if "subtitle" in keywords: markup = abjad.Markup(keywords.get("subtitle")) lilypond_file.header_block.subtitle = markup command = abjad.LilyPondLiteral(r"\accidentalStyle forget") lilypond_file.layout_block.items.append(command) lilypond_file.layout_block.indent = 0 string = "markup-system-spacing.padding = 8" command = abjad.LilyPondLiteral(string) lilypond_file.paper_block.items.append(command) string = "system-system-spacing.padding = 10" command = abjad.LilyPondLiteral(string) lilypond_file.paper_block.items.append(command) string = "top-markup-spacing.padding = 4" command = abjad.LilyPondLiteral(string) lilypond_file.paper_block.items.append(command) return lilypond_file
def clicks_2_3_per_second(): return abjad.Markup("clicks (2-3/sec.)", direction=abjad.Up).upright()
def null(): return abjad.Markup().null()
def two_thirds_OB(): return abjad.Markup("2/3OB", direction=abjad.Up).upright()
def XP(): return abjad.Markup("XP", direction=abjad.Up).upright()
def tasto_scratch(): return abjad.Markup("tasto + scratch", direction=abjad.Up).upright()
def tasto_XFB_flaut(): return abjad.Markup("tasto + XFB flaut.", direction=abjad.Up).upright()
def test_ArtificialHarmonic_16(): harm = auxjad.ArtificialHarmonic(r"<a d'>1") abjad.attach(abjad.Markup('test'), harm) harm.markup = 'I.' with pytest.raises(Exception): harm.markup = None
def ord(): return abjad.Markup("ord.", direction=abjad.Up).upright()
upper_measures[0][0].dynamics.mark = "pp" abjad.Beam(upper_measures[0]) upper_measures[1][1].dynamics.mark = "mp" abjad.Beam(upper_measures[1][1:]) abjad.Beam(upper_measures[2][0:3]) abjad.Beam(upper_measures[2][3:]) abjad.Tie(upper_staff[-2:]) abjad.Slur(upper_staff.leaves[0:5]) abjad.Slur(upper_staff.leaves[5:]) abjad.Crescendo(upper_staff.leaves[-7:-2]) abjad.Decrescendo(upper_staff.leaves[-2:]) tx = abjad.Text(upper_staff.leaves[-7:]) tx.bound_details__left__text = abjad.Markup("ritard.") # lower staff lower_staff.clef.forced = abjad.Clef("bass") abjad.Tie([v1a[0], v1b[0]]) abjad.Beam(lower_staff.leaves[1:5]) abjad.Beam(lower_staff.leaves[6:10]) abjad.Beam(lower_staff.leaves[10:13]) abjad.Slur(lower_staff.leaves[1:6]) slr = abjad.Slur(lower_staff.leaves[6:13] + [v2a, v2b]) slr.position = Down
def apply_expressive_marks(score): """ Applies expressive marks to score. """ voice = score["First Violin Voice"] markup = abjad.Markup(r"\left-column { div. \line { con sord. } }", direction=abjad.Up) abjad.attach(markup, voice[6][1]) markup = abjad.Markup("sim.", direction=abjad.Up) abjad.attach(markup, voice[8][0]) markup = abjad.Markup("uniti", direction=abjad.Up) abjad.attach(markup, voice[58][3]) markup = abjad.Markup("div.", direction=abjad.Up) abjad.attach(markup, voice[59][0]) markup = abjad.Markup("uniti", direction=abjad.Up) abjad.attach(markup, voice[63][3]) voice = score["Second Violin Voice"] markup = abjad.Markup("div.", direction=abjad.Up) abjad.attach(markup, voice[7][0]) markup = abjad.Markup("uniti", direction=abjad.Up) abjad.attach(markup, voice[66][1]) markup = abjad.Markup("div.", direction=abjad.Up) abjad.attach(markup, voice[67][0]) markup = abjad.Markup("uniti", direction=abjad.Up) abjad.attach(markup, voice[74][0]) voice = score["Viola Voice"] markup = abjad.Markup("sole", direction=abjad.Up) abjad.attach(markup, voice[8][0]) voice = score["Cello Voice"] markup = abjad.Markup("div.", direction=abjad.Up) abjad.attach(markup, voice[10][0]) markup = abjad.Markup("uniti", direction=abjad.Up) abjad.attach(markup, voice[74][0]) markup = abjad.Markup("uniti", direction=abjad.Up) abjad.attach(markup, voice[84][1]) markup = abjad.Markup(r"\italic { espr. }", direction=abjad.Down) abjad.attach(markup, voice[86][0]) markup = abjad.Markup(r"\italic { molto espr. }", direction=abjad.Down) abjad.attach(markup, voice[88][1]) voice = score["Bass Voice"] markup = abjad.Markup("div.", direction=abjad.Up) abjad.attach(markup, voice[14][0]) markup = abjad.Markup(r"\italic { espr. }", direction=abjad.Down) abjad.attach(markup, voice[86][0]) abjad.mutate(voice[88][:]).split( [abjad.Duration(1, 1), abjad.Duration(1, 2)]) markup = abjad.Markup(r"\italic { molto espr. }", direction=abjad.Down) abjad.attach(markup, voice[88][1]) markup = abjad.Markup("uniti", direction=abjad.Up) abjad.attach(markup, voice[99][1]) strings_staff_group = score["Strings Staff Group"] for voice in abjad.iterate(strings_staff_group).components(abjad.Voice): markup = abjad.Markup(r"\italic { (non dim.) }", direction=abjad.Down) abjad.attach(markup, voice[102][0])
def __call__(self): name = self.instrument.instrument_name.title() short_name = self.instrument.short_instrument_name.title() # Create staves embouchure_rhythm_staff = abjad.scoretools.Staff( [], context_name='RhythmStaff', name='Embouchure Rhythm' ) embouchure_staff = abjad.scoretools.Staff( [], context_name='EmbouchureStaff', is_simultaneous=True, name='Embouchure', ) lh_fingering_rhythm_staff = abjad.scoretools.Staff( [], context_name='RhythmStaff', name='Left Hand Fingering Rhythm', ) lh_fingering_staff = abjad.scoretools.Staff( [], context_name='WoodwindFingeringStaff', is_simultaneous=True, name='Left Hand Fingering', ) rh_fingering_staff = abjad.scoretools.Staff( [], context_name='WoodwindFingeringStaff', is_simultaneous=True, name='Right Hand Fingering', ) rh_fingering_rhythm_staff = abjad.scoretools.Staff( [], context_name='RhythmStaff', name='Right Hand Fingering Rhythm', ) # Combine subgroup = abjad.StaffGroup( [ embouchure_staff, lh_fingering_rhythm_staff, lh_fingering_staff, rh_fingering_staff, ], context_name='StaffSubgroup', name=name + ' Staff Subgroup' ) staff_list = [ embouchure_rhythm_staff, subgroup, rh_fingering_rhythm_staff, ] instrument_staff_group = abjad.StaffGroup( staff_list, context_name='WoodwindInstrumentStaffGroup', name=name + ' Staff Group' ) # Set Names abjad.annotate(embouchure_rhythm_staff, 'instrument', name) abjad.annotate(embouchure_staff, 'instrument', name) abjad.setting(embouchure_staff).instrument_name = abjad.Markup('Emb.') abjad.setting(embouchure_staff).short_instrument_name = \ abjad.Markup('Emb.') abjad.annotate(lh_fingering_rhythm_staff, 'instrument', name) abjad.setting(lh_fingering_staff).instrument_name = \ abjad.Markup('L.H.') abjad.setting(lh_fingering_staff).short_instrument_name = \ abjad.Markup('L.H.') abjad.annotate(lh_fingering_staff, 'instrument', name) abjad.setting(rh_fingering_staff).instrument_name = \ abjad.Markup('R.H.') abjad.setting(rh_fingering_staff).short_instrument_name = \ abjad.Markup('R.H.') abjad.annotate(rh_fingering_staff, 'instrument', name) abjad.annotate(rh_fingering_rhythm_staff, 'instrument', name) abjad.setting(instrument_staff_group).instrument_name = \ abjad.Markup(name) abjad.setting(instrument_staff_group).instrument_name = \ abjad.Markup(short_name) # Set Stem Direction abjad.override(embouchure_rhythm_staff).stem.direction = \ abjad.schemetools.Scheme('UP') abjad.override(lh_fingering_rhythm_staff).stem.direction = \ abjad.schemetools.Scheme('UP') abjad.override(rh_fingering_rhythm_staff).stem.direction = \ abjad.schemetools.Scheme('DOWN') # Set Padding override.staff_space_after(embouchure_rhythm_staff, 2) override.staff_space_after(embouchure_staff, 8) override.staff_space_after(lh_fingering_rhythm_staff, 2) override.staff_space_after(lh_fingering_staff, 4) override.staff_space_after(rh_fingering_staff, 2) override.staff_space_after(rh_fingering_rhythm_staff, 10) # hide span bars on first and last rhythm staff, and rh fingering abjad.override(embouchure_rhythm_staff).bar_line.allow_span_bar = False abjad.override(embouchure_rhythm_staff).bar_line.transparent = True # abjad.override(lh_fingering_rhythm_staff).bar_line.transparent = True abjad.override(rh_fingering_staff).bar_line.allow_span_bar = False abjad.override(rh_fingering_rhythm_staff)\ .bar_line.allow_span_bar = False abjad.override(rh_fingering_rhythm_staff).bar_line.transparent = True return instrument_staff_group
format_slot="after", ), abjad.LilyPondLiteral( r"^ \markup { arco \raise #0.75 \baca-circle-very-wide-markup }", format_slot="after", ), abjad.LilyPondLiteral( r"^ \markup { clt. \raise #0.75 \baca-circle-fast-markup }", format_slot="after", ), ], forget=False, ) section_title = abjad.Markup( r"""\markup \override #'(font-name . "STIXGeneral Bold") \column { \box \caps "Komm Komm Komm" \caps "[Komm (v)]" }""", direction=abjad.Down, ) maker = evans.SegmentMaker( instruments=insts, names=[ '"Violin I"', '"Violin II"', '"Viola"', '"Violoncello"', ], abbreviations=[ '"vn. I"', '"vn. II"', '"va."', '"vc."',
def after_music(self, music): super().after_music(music) mute_command = abjad.Markup("mute on", direction=Up) abjad.attach(mute_command, music[0])
def flaut_pont(): return abjad.Markup("\\center-column {flaut.- pont.}", direction=abjad.Up).upright()
def mx(): return abjad.Markup("\\bold MX.", direction=abjad.Up).upright()
for staff in abjad.iterate(score["Staff Group 1"]).components(abjad.Staff): for rest in abjad.iterate(staff).components(abjad.Rest): previous_leaf = abjad.inspect(rest).leaf(-1) if isinstance(previous_leaf, abjad.Note): abjad.attach(abjad.StopHairpin(), rest) elif isinstance(previous_leaf, abjad.Chord): abjad.attach(abjad.StopHairpin(), rest) elif isinstance(previous_leaf, abjad.Rest): pass # attach instruments and clefs print("Adding attachments ...") bar_line = abjad.BarLine("||") metro = abjad.MetronomeMark((1, 4), 60) markup1 = abjad.Markup(r"\bold { A }") markup2 = abjad.Markup(r"\bold { B }") markup3 = abjad.Markup(r"\bold { C }") markup4 = abjad.Markup(r"\bold { D }") markup5 = abjad.Markup(r"\bold { E }") markup6 = abjad.Markup(r"\bold { F }") mark1 = abjad.RehearsalMark(markup=markup1) mark2 = abjad.RehearsalMark(markup=markup2) mark3 = abjad.RehearsalMark(markup=markup3) mark4 = abjad.RehearsalMark(markup=markup4) mark5 = abjad.RehearsalMark(markup=markup5) mark6 = abjad.RehearsalMark(markup=markup6) def _apply_numerators_and_tech(staff, nums, tech): numerators = cyc(nums)
def pont(): return abjad.Markup("sul pont.", direction=abjad.Up).upright()
def tasto_slow_bow(): return abjad.Markup("tasto + slow bow", direction=abjad.Up).upright()
def mark(num): string = f"\\mark #{num}" return abjad.Markup(string, direction=abjad.Up).upright()
def trans(): return abjad.Markup("trans.", direction=abjad.Up).upright()
def rhythmically(): return abjad.Markup("rhythmically", direction=abjad.Up).upright()
def x_8(): return (abjad.Markup("x8", direction=abjad.Up).sans().bold().fontsize( 6).upright().box().override(("box-padding", 0.5)))
def sul_IV(): return abjad.Markup("sul IV", direction=abjad.Up).upright()
def XP_full_bow_strokes(): return abjad.Markup("XP + full bow strokes", direction=abjad.Up).upright()
def tasto(): return abjad.Markup("sul tasto", direction=abjad.Up).upright()
def MP_XFB_flaut(): return abjad.Markup("MP + XFB flaut.", direction=abjad.Up).upright()
def flaut(): return abjad.Markup("flautando", direction=abjad.Up).upright()
def OB_no_pitch(): return abjad.Markup("OB (no pitch)", direction=abjad.Up).upright()
def make_tableaux_chart(fundamental_patterns, subdivisions): print("instantiating parser, staff group, and patterns ...") parser = abjad.rhythmtrees.RhythmTreeParser() print("beginning loop ...") for i, fundamental_pattern in enumerate(fundamental_patterns): print(fundamental_pattern) print("gathering pattern ...") print("permuting pattern ...") for permutation in list( set([_ for _ in itertools.permutations(fundamental_pattern)])): permutation = list(permutation) print(permutation) title = fr"Mutations of {permutation}" final_patterns = [] parsed_patterns = abjad.Staff(lilypond_type="RhythmicStaff") for num_indices in range(len(permutation) + 1): print("gathing number of possible dividable beats ...") if num_indices == 0: print("do not subdivide!") print("converting to string ...") subgrouped_permutation = ( f"(1 {evans.nested_list_to_rtm(permutation)})") print("gathing number of rotatable positions ...") l_ = -1 for symbol in subgrouped_permutation: if symbol.isdigit(): l_ = l_ + 1 for y in range(l_): print("rotating ...") rotation = evans.rotate_tree( rtm_string=subgrouped_permutation, n=y) print(rotation) print("funneling rotation to 1 ...") for funnel in evans.funnel_inner_tree_to_x( rtm_string=rotation, x=1): print("caching funnel ...") print(funnel) final_patterns.append(funnel) else: print("subdivide!") print("gathering possible subdivisions ...") for division_group in itertools.combinations_with_replacement( subdivisions, num_indices): division_group = list(division_group) print("gathering possible subdivision locations ...") possible_indices = [_ for _ in range(len(permutation))] for index_group in itertools.combinations( possible_indices, num_indices): index_group = list(index_group) print("adding subgroups ...") subdivided_permutation = add_subgroups( input_list=permutation, index_list=index_group, subgroup_list=division_group, ) print("converting to string ...") subgrouped_permutation = evans.nested_list_to_rtm( subdivided_permutation) print(subgrouped_permutation) print("gathing number of rotatable positions ...") l_ = -1 for symbol in subgrouped_permutation: if symbol.isdigit(): l_ = l_ + 1 for y in range(l_): print("rotating ...") rotation = evans.rotate_tree( rtm_string=subgrouped_permutation, n=y) print(rotation) print("funneling rotation to 1 ...") for funnel in evans.funnel_inner_tree_to_x( rtm_string=rotation, x=1): print("caching funnel ...") print(funnel) final_patterns.append(funnel) print("parsing cached funnels ...") for pattern in final_patterns: print(pattern) pair = (1, 2) time_signature = abjad.TimeSignature(pair) rhythm_tree_list = parser(pattern) rhythm_tree_container = rhythm_tree_list[0] r = rhythm_tree_container(pair) m = abjad.Markup(fr"\markup {pattern}", direction=abjad.Up, literal=True) abjad.attach(m, abjad.select(r).leaves()[0]) abjad.attach(time_signature, abjad.select(r).leaves()[0]) print("adding parsed funnel to staff ...") parsed_patterns.extend(r) print("adding staff to staff group ...") score = abjad.Score([parsed_patterns]) scheme = abjad.SchemeMoment((1, 50)) abjad.setting(score).proportional_notation_duration = scheme new_brackets = evans.NoteheadBracketMaker() for staff in abjad.select(score).components(abjad.Staff): new_brackets(staff) abjad.override(score).TupletBracket.bracket_visibility = True print("rendering staff group ...") file = abjad.LilyPondFile( items=[ score, abjad.Block(name="layout"), abjad.Block(name="header") ], includes=[ "/Users/evansdsg2/abjad/docs/source/_stylesheets/abjad.ily" ], global_staff_size=14, default_paper_size=("11x17landscape", "portrait"), ) file.layout_block.items.append("indent = 0") file.header_block.items.append("tagline = ##f") file.header_block.items.append(f'title = "{title}"') abjad.show(file)