コード例 #1
0
def _make_margin_markup(name):
    if isinstance(name, str):
        string = rf'\markup \hcenter-in #16 "{name}"'
    elif isinstance(name, list) and len(name) == 2:
        line_1 = rf'\hcenter-in #16 "{name[0]}"'
        line_2 = rf'\hcenter-in #16 "{name[1]}"'
        string = rf"\markup \column {{ {line_1} {line_2} }}"
    elif isinstance(name, list) and len(name) == 3:
        line_1 = rf'\hcenter-in #16 "{name[0]}"'
        line_2 = rf'\hcenter-in #16 "{name[1]}"'
        line_3 = rf'\hcenter-in #16 "{name[2]}"'
        string = rf"\markup \column {{ {line_1} {line_2} {line_3} }}"
    return abjad.MarginMarkup(markup=string)
コード例 #2
0
    abjad.AltoSaxophone(),
    abjad.AltoSaxophone(),
    abjad.AltoSaxophone(),
    abjad.TenorSaxophone(),
    abjad.TenorSaxophone(),
    abjad.TenorSaxophone(),
    abjad.BaritoneSaxophone(),
    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',
コード例 #3
0
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)

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)
コード例 #4
0
    for i, logicl_tie in enumerate(logicl_ties):
        if logicl_tie.is_pitched == True:
            pitch = next(pitches)
            for note in logicl_tie:
                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)
コード例 #5
0
ファイル: definition.py プロジェクト: GregoryREvans/cthar
for voice in abjad.select(score["Voice 3"]).components(abjad.Voice):
    for run in abjad.select(voice).runs():
        specifier = abjadext.rmakers.BeamSpecifier(beam_each_division=False)
        specifier(run)

instruments1 = cyc([abjad.Cello()])

instruments2 = cyc([abjad.Cello()])

clefs1 = cyc([abjad.Clef("percussion"), abjad.Clef("percussion"), abjad.Clef("bass")])

clefs2 = cyc([abjad.Clef("percussion"), abjad.Clef("percussion"), abjad.Clef("bass")])

abbreviations1 = cyc(
    [
        abjad.MarginMarkup(markup=abjad.Markup("B.H.")),
        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(
    [
コード例 #6
0
ファイル: definition.py プロジェクト: grrrr/rill
import abjad

margin_markups = abjad.OrderedDict([
    ("Va. I", abjad.MarginMarkup(markup=r"\ins-wasser-va-i-markup")),
    ("Va. II", abjad.MarginMarkup(markup=r"\ins-wasser-va-ii-markup")),
])
コード例 #7
0
instruments1 = cyc([abjad.Cello()])

instruments2 = cyc([abjad.Cello()])

clefs1 = cyc(
    [abjad.Clef("percussion"),
     abjad.Clef("percussion"),
     abjad.Clef("bass")])

clefs2 = cyc(
    [abjad.Clef("percussion"),
     abjad.Clef("percussion"),
     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")),
])
コード例 #8
0
    abjad.AltoSaxophone(),
    abjad.AltoSaxophone(),
    abjad.AltoSaxophone(),
    abjad.TenorSaxophone(),
    abjad.TenorSaxophone(),
    abjad.TenorSaxophone(),
    abjad.BaritoneSaxophone(),
    abjad.BaritoneSaxophone(),
    abjad.BaritoneSaxophone(),
    abjad.BassSaxophone(),
    abjad.BassSaxophone(),
    abjad.ContrabassSaxophone(),
])

abbreviations = cyc([
    abjad.MarginMarkup(markup=abjad.Markup('spro.'), ),
    abjad.MarginMarkup(markup=abjad.Markup('spr.1'), ),
    abjad.MarginMarkup(markup=abjad.Markup('spr.2'), ),
    abjad.MarginMarkup(markup=abjad.Markup('spr.3'), ),
    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.'), ),
コード例 #9
0
    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)