コード例 #1
0
 def __illustrate__(self, scale=None, target_timespan=None, **kwargs):
     target_timespan = target_timespan or abjad.Timespan(0, 16)
     assert isinstance(target_timespan, abjad.Timespan)
     assert 0 < target_timespan.duration
     scale = scale or 1.5
     music_specifiers = abjad.OrderedDict([
         ('A', 'A music'),
         ('B', 'B music'),
         ('C', 'C music'),
         ('D', 'D music'),
         ('E', 'E music'),
         ('F', 'F music'),
         ('G', 'G music'),
         ('H', 'H music'),
         ('I', 'I music'),
         ('J', 'J music'),
     ])
     timespan_list = self(
         layer=0,
         music_specifiers=music_specifiers,
         target_timespan=target_timespan,
     )
     ti_lilypond_file = timespan_list.__illustrate__(
         key='voice_name',
         range_=target_timespan,
         scale=scale,
     )
     ti_markup = ti_lilypond_file.items[-1]
     offset_counter = abjad.OffsetCounter(timespan_list)
     oc_lilypond_file = offset_counter.__illustrate__(
         range_=target_timespan,
         scale=scale,
     )
     oc_markup = oc_lilypond_file.items[-1]
     lilypond_file = abjad.LilyPondFile.new(
         default_paper_size=['tabloid', 'landscape'],
         date_time_token=False,
     )
     lilypond_file.items.extend([
         abjad.String.normalize('''
         % Backport for pre 2.19.20 versions of LilyPond
         #(define-markup-command (overlay layout props args)
             (markup-list?)
             (apply ly:stencil-add (interpret-markup-list layout props args)))
         '''),
         ti_markup,
         abjad.Markup.null().pad_around(2),
         oc_markup,
     ])
     lilypond_file.header_block.tagline = False
     return lilypond_file
コード例 #2
0
 def __illustrate__(self, scale=None, target_timespan=None, **kwargs):
     target_timespan = target_timespan or abjad.Timespan(0, 16)
     assert isinstance(target_timespan, abjad.Timespan)
     assert 0 < target_timespan.duration
     scale = scale or 1.5
     music_specifiers = dict([
         ("A", "A music"),
         ("B", "B music"),
         ("C", "C music"),
         ("D", "D music"),
         ("E", "E music"),
         ("F", "F music"),
         ("G", "G music"),
         ("H", "H music"),
         ("I", "I music"),
         ("J", "J music"),
     ])
     timespan_list = self(
         layer=0,
         music_specifiers=music_specifiers,
         target_timespan=target_timespan,
     )
     ti_lilypond_file = timespan_list.__illustrate__(
         key="voice_name",
         range_=target_timespan,
         scale=scale,
     )
     ti_markup = ti_lilypond_file.items[-1]
     offset_counter = abjad.OffsetCounter(timespan_list)
     oc_lilypond_file = offset_counter.__illustrate__(
         range_=target_timespan,
         scale=scale,
     )
     oc_markup = oc_lilypond_file.items[-1]
     lilypond_file = abjad.LilyPondFile.new(
         default_paper_size=["tabloid", "landscape"],
         date_time_token=False,
     )
     lilypond_file.items.extend([
         abjad.String.normalize("""
         % Backport for pre 2.19.20 versions of LilyPond
         #(define-markup-command (overlay layout props args)
             (markup-list?)
             (apply ly:stencil-add (interpret-markup-list layout props args)))
         """),
         ti_markup,
         abjad.Markup.null().pad_around(2),
         oc_markup,
     ])
     lilypond_file.header_block.tagline = False
     return lilypond_file
コード例 #3
0
import pathlib

import abjad

from chalk_line.materials.timespans.segment_01.make_timespans import (
    rhythm_timespan_list, )

offset_counter = abjad.OffsetCounter(rhythm_timespan_list)

counter_path = f"""{pathlib.Path(__file__).parent}/segment_01_offset_counter.pdf"""
persisted_counter = abjad.persist.as_pdf(offset_counter,
                                         counter_path,
                                         scale=0.70)

permitted_meters = abjad.MeterList([
    (5, 4),
    (9, 8),
    (4, 4),
    (7, 8),
    (3, 4),
    (5, 8),
    (2, 4),
    (3, 8),
    (5, 16),
    (1, 4),
    # (3, 16),
    # (1, 8),
])

fitted_meters = abjad.Meter.fit_meters(argument=offset_counter,
                                       meters=permitted_meters,
コード例 #4
0
    final_list.append(new_ts)
    meters.append(abjad.Meter(new_ts.duration))

permitted_meters = [
    # (7, 4),
    (5, 4),
    (4, 4),
    (3, 4),
    (3, 8),
    (11, 16),
    # (3, 16),
]

# remove repeated
coincident_offsets = list(dict.fromkeys(coincident_offsets))
# print(coincident_offsets)

offset_counter = abjad.OffsetCounter(coincident_offsets)
fitted_meters = abjad.Meter.fit_meters(
    argument=offset_counter,
    meters=permitted_meters,  # maximum_run_length=1
)
time_signatures = [_.implied_time_signature for _ in fitted_meters]

for i in time_signatures:
    print("Time Signature:", i)

if __name__ == "__main__":
    # abjad.show(final_list, scale=0.8, key="annotation")
    pass
コード例 #5
0
ファイル: meter_fitting.py プロジェクト: jgarte/evans
        1,
        2,
        3,
        2,
    ),  # smashes timespans together without intermittent silence
    silence_talea=rmakers.Talea(counts=(2, 1, 1), denominator=4),
    # fuse_groups=False, #turns groups from multiple timespans into one large timespan
)

timespan_list = timespan_maker(music_specifiers=music_specifiers,
                               target_timespan=target_timespan)

# abjad.show(timespan_list, scale=0.7, key='voice_name')
timespan_list
#
offset_counter = abjad.OffsetCounter(timespan_list)

# abjad.show(offset_counter, scale=0.7)
####
permitted_meters = abjad.MeterList([(3, 4), (4, 4), (5, 16), (7, 8)])

# abjad.show(permitted_meters, scale=0.7)
#
fitted_meters = abjad.Meter.fit_meters(argument=offset_counter,
                                       meters=permitted_meters,
                                       maximum_run_length=1)

# abjad.show(fitted_meters, scale=0.7)

# groups = [timespan.voice_name for timespan in timespan_list]
# input = [(span, group) for span, group in zip(timespan_list, groups)]