note.written_pitch = pitch #attach instruments and clefs print('Adding attachments ...') instruments = cyc([ abjad.SopraninoSaxophone(), ]) abbreviations = cyc([ abjad.MarginMarkup(markup=abjad.Markup(' '), ), ]) names = cyc([ abjad.StartMarkup(markup=abjad.Markup('Fundamental Harmony'), ), ]) clefs = cyc([ abjad.Clef('treble'), abjad.Clef('bass'), ]) for staff in abjad.iterate(score['Staff Group']).components(abjad.Staff): leaf1 = abjad.select(staff).leaves()[0] # abjad.attach(next(instruments), leaf1) # abjad.attach(next(abbreviations), leaf1) # abjad.attach(next(names), leaf1) abjad.attach(next(clefs), leaf1) for staff in abjad.select(score['Staff 1']).components(abjad.Staff):
abjad.BaritoneSaxophone(), abjad.BaritoneSaxophone(), abjad.BassSaxophone(), abjad.BassSaxophone(), abjad.ContrabassSaxophone(), ]) abbreviations = cyc([ abjad.MarginMarkup(markup=abjad.Markup(abbrev)) for abbrev in ('spro.', 'spr.1', 'spr.2', 'spr.3', 'alt.1', 'alt.2', 'alt.3', 'ten.1', 'ten.2', 'ten.3', 'bar.1', 'bar.2', 'bar.3', 'bs.1', 'bs.2', 'cb.') ]) names = cyc([ abjad.StartMarkup(markup=abjad.Markup(name)) for name in ( 'Sopranino', 'Soprano 1', 'Soprano 2', 'Soprano 3', 'Alto 1', 'Alto 2', 'Alto 3', 'Tenor 1', 'Tenor 2', 'Tenor 3', 'Baritone 1', 'Baritone 2', 'Baritone 3', 'Bass 1', 'Bass 2',
mark4 = abjad.RehearsalMark(markup=markup4) mark5 = abjad.RehearsalMark(markup=markup5) mark6 = abjad.RehearsalMark(markup=markup6) instruments1 = cyc([abjad.Flute(), abjad.AltoSaxophone(), abjad.Cello()]) clefs1 = cyc([abjad.Clef("treble"), abjad.Clef("treble"), abjad.Clef("bass")]) abbreviations1 = cyc([ abjad.MarginMarkup(markup=abjad.Markup("fl.")), abjad.MarginMarkup(markup=abjad.Markup("sx.")), abjad.MarginMarkup(markup=abjad.Markup("vc.")), ]) names1 = cyc([ abjad.StartMarkup(markup=abjad.Markup("Flute")), abjad.StartMarkup(markup=abjad.Markup("Saxophone")), abjad.StartMarkup(markup=abjad.Markup("Violoncello")), ]) for staff in abjad.iterate(score["Staff Group 1"]).components(abjad.Staff): leaf1 = abjad.select(staff).leaves()[0] abjad.attach(next(instruments1), leaf1) abjad.attach(next(abbreviations1), leaf1) abjad.attach(next(names1), leaf1) abjad.attach(next(clefs1), leaf1) for staff in abjad.select(score["Staff Group 1"]).components(abjad.Staff): leaf1 = abjad.select(staff).leaves()[0] last_leaf = abjad.select(staff).leaves()[-1] abjad.attach(metro, leaf1)
abjad.MarginMarkup(markup=abjad.Markup("vc.I")), abjad.MarginMarkup(markup=abjad.Markup("L.H.")), ] ) abbreviations2 = cyc( [ abjad.MarginMarkup(markup=abjad.Markup("B.H.")), abjad.MarginMarkup(markup=abjad.Markup("vc.II")), abjad.MarginMarkup(markup=abjad.Markup("L.H.")), ] ) names1 = cyc( [ abjad.StartMarkup(markup=abjad.Markup("Bow Hand")), abjad.StartMarkup(markup=abjad.Markup("Violoncello I")), abjad.StartMarkup(markup=abjad.Markup("Left Hand")), ] ) names2 = cyc( [ abjad.StartMarkup(markup=abjad.Markup("Bow Hand")), abjad.StartMarkup(markup=abjad.Markup("Violoncello II")), abjad.StartMarkup(markup=abjad.Markup("Left Hand")), ] ) for staff in abjad.iterate(score["Staff Group 1"]).components(abjad.Staff): leaf1 = abjad.select(staff).leaves()[0]
abjad.Clef("bass")]) abbreviations1 = cyc([ abjad.MarginMarkup(markup=abjad.Markup("_")), abjad.MarginMarkup(markup=abjad.Markup("_")), abjad.MarginMarkup(markup=abjad.Markup("vc.I")), ]) abbreviations2 = cyc([ abjad.MarginMarkup(markup=abjad.Markup("_")), abjad.MarginMarkup(markup=abjad.Markup("_")), abjad.MarginMarkup(markup=abjad.Markup("vc.II")), ]) names1 = cyc([ abjad.StartMarkup(markup=abjad.Markup("_")), abjad.StartMarkup(markup=abjad.Markup(" ")), abjad.StartMarkup(markup=abjad.Markup("Violoncello I")), ]) names2 = cyc([ abjad.StartMarkup(markup=abjad.Markup("_")), abjad.StartMarkup(markup=abjad.Markup(" ")), abjad.StartMarkup(markup=abjad.Markup("Violoncello II")), ]) for staff in abjad.iterate(score["Staff Group 1"]).components(abjad.Staff): leaf1 = abjad.select(staff).leaves()[0] abjad.attach(next(instruments1), leaf1) ab = next(abbreviations1) nm = next(names1)
abjad.MarginMarkup(markup=abjad.Markup('alt.1'), ), abjad.MarginMarkup(markup=abjad.Markup('alt.2'), ), abjad.MarginMarkup(markup=abjad.Markup('alt.3'), ), abjad.MarginMarkup(markup=abjad.Markup('ten.1'), ), abjad.MarginMarkup(markup=abjad.Markup('ten.2'), ), abjad.MarginMarkup(markup=abjad.Markup('ten.3'), ), abjad.MarginMarkup(markup=abjad.Markup('bar.1'), ), abjad.MarginMarkup(markup=abjad.Markup('bar.2'), ), abjad.MarginMarkup(markup=abjad.Markup('bar.3'), ), abjad.MarginMarkup(markup=abjad.Markup('bs.1'), ), abjad.MarginMarkup(markup=abjad.Markup('bs.2'), ), abjad.MarginMarkup(markup=abjad.Markup('cbs.'), ), ]) names = cyc([ abjad.StartMarkup(markup=abjad.Markup('Sopranino'), ), abjad.StartMarkup(markup=abjad.Markup('Soprano 1'), ), abjad.StartMarkup(markup=abjad.Markup('Soprano 2'), ), abjad.StartMarkup(markup=abjad.Markup('Soprano 3'), ), abjad.StartMarkup(markup=abjad.Markup('Alto 1'), ), abjad.StartMarkup(markup=abjad.Markup('Alto 2'), ), abjad.StartMarkup(markup=abjad.Markup('Alto 3'), ), abjad.StartMarkup(markup=abjad.Markup('Tenor 1'), ), abjad.StartMarkup(markup=abjad.Markup('Tenor 2'), ), abjad.StartMarkup(markup=abjad.Markup('Tenor 3'), ), abjad.StartMarkup(markup=abjad.Markup('Baritone 1'), ), abjad.StartMarkup(markup=abjad.Markup('Baritone 2'), ), abjad.StartMarkup(markup=abjad.Markup('Baritone 3'), ), abjad.StartMarkup(markup=abjad.Markup('Bass 1'), ), abjad.StartMarkup(markup=abjad.Markup('Bass 2'), ), abjad.StartMarkup(markup=abjad.Markup('Contrabass'), ),
def _add_attachments(self): print("Adding attachments ...") if self.colophon is not None: last_voice = abjad.select(self.score_template).components( abjad.Voice)[-1] # colophon_leaf = abjad.select(last_voice).leaves()[-2] # abjad.attach(self.colophon, colophon_leaf) if self.abbreviations is not None: abbreviations = [] abb = self.abbreviations mark_abbreviations = [ abjad.Markup(fr"\markup {{ \hcenter-in #12 {_} }}", literal=True) for _ in abb ] for x in mark_abbreviations: abbreviations.append(abjad.MarginMarkup(markup=x)) else: abbreviations = [_ for _ in range(len(self.instruments))] if self.names is not None: names = [] nm = self.names mark_names = [ abjad.Markup(fr"\markup {{ \hcenter-in #14 {_} }}", literal=True) for _ in nm ] for x in mark_names: names.append(abjad.StartMarkup(markup=x)) else: names = [_ for _ in range(len(self.instruments))] metro = abjad.MetronomeMark(self.tempo[0], self.tempo[1]) # metro = abjad.MetronomeMark(custom_markup=metro.make_tempo_equation_markup())#remove if broken if self.tempo is not None: for staff in abjad.iterate( self.score_template["Global Context"]).components( abjad.Staff): leaf1 = abjad.select(staff).leaves()[0] abjad.attach(metro, leaf1) markup2 = abjad.RehearsalMark(markup=abjad.Markup( fr"\markup \bold {{ {self.rehearsal_mark} }}", literal=True)) if self.rehearsal_mark is not None: for staff in abjad.iterate( self.score_template["Global Context"]).components( abjad.Staff): leaf1 = abjad.select(staff).leaves()[0] abjad.attach(markup2, leaf1) bar_line = abjad.BarLine(self.barline) if self.barline is not None: for voice in abjad.iterate( self.score_template["Staff Group"]).components( abjad.Staff # was Voice ): if self.barline == "|.": last_leaf = abjad.select(voice).leaves()[-1] abjad.attach(bar_line, last_leaf) else: last_leaf = abjad.select(voice).leaves()[-3] abjad.attach(bar_line, last_leaf) if self.clef_handlers is None: self.clef_handlers = [ None for _ in abjad.select( self.score_template["Staff Group"]).components(abjad.Staff) ] for abbrev, name, inst, handler, voice in zip( abbreviations, names, self.instruments, self.clef_handlers, abjad.select(self.score_template["Staff Group"]).components( abjad.Staff), # was Voice ): first_leaf = abjad.select(voice).leaves()[0] if self.name_staves is True: if not isinstance(abbrev, int): abjad.attach( abbrev, first_leaf, tag=abjad.Tag("applying staff names and clefs"), ) if not isinstance(name, int): abjad.attach( name, first_leaf, tag=abjad.Tag("applying staff names and clefs"), ) abjad.attach(inst, first_leaf, tag=abjad.Tag("applying staff names and clefs")) # abjad.iterpitches.transpose_from_sounding_pitch(voice) if handler is not None: handler(voice)