Ejemplo n.º 1
0
 def __init__(
     self,
     time_signatures=None,
     divisions=None,
     rh_rhythm_maker=None,
     lh_rhythm_maker=None,
     rh_pitch_range=None,
     lh_pitch_range=None,
 ):
     SegmentMaker.__init__(self)
     time_signatures = time_signatures or []
     time_signatures = [
         indicatortools.TimeSignature(x) for x in time_signatures
     ]
     self._time_signatures = time_signatures
     self._divisions = divisions
     if rh_rhythm_maker is None:
         rh_rhythm_maker = rhythmmakertools.NoteRhythmMaker()
     assert isinstance(rh_rhythm_maker, rhythmmakertools.RhythmMaker)
     self._rh_rhythm_maker = rh_rhythm_maker
     if lh_rhythm_maker is None:
         lh_rhythm_maker = rhythmmakertools.NoteRhythmMaker()
     assert isinstance(lh_rhythm_maker, rhythmmakertools.RhythmMaker)
     self._lh_rhythm_maker = lh_rhythm_maker
     rh_pitch_range = rh_pitch_range or '[C4, C6]'
     rh_pitch_range = pitchtools.PitchRange(rh_pitch_range)
     self._rh_pitch_range = rh_pitch_range
     lh_pitch_range = lh_pitch_range or '[C2, C4)'
     lh_pitch_range = pitchtools.PitchRange(lh_pitch_range)
     self._lh_pitch_range = lh_pitch_range
Ejemplo n.º 2
0
 def __init__(
     self,
     time_signatures=None,
     divisions=None,
     rh_rhythm_maker=None,
     lh_rhythm_maker=None,
     rh_pitch_range=None,
     lh_pitch_range=None,
     include_layout_ly=None,
     ):
     import abjad
     from abjad.tools import rhythmmakertools
     SegmentMaker.__init__(self)
     time_signatures = time_signatures or []
     time_signatures = [abjad.TimeSignature(_) for _ in time_signatures]
     self._time_signatures = time_signatures
     self._divisions = divisions
     if rh_rhythm_maker is None:
         rh_rhythm_maker = rhythmmakertools.NoteRhythmMaker()
     assert isinstance(rh_rhythm_maker, rhythmmakertools.RhythmMaker)
     self._rh_rhythm_maker = rh_rhythm_maker
     if lh_rhythm_maker is None:
         lh_rhythm_maker = rhythmmakertools.NoteRhythmMaker()
     assert isinstance(lh_rhythm_maker, rhythmmakertools.RhythmMaker)
     self._lh_rhythm_maker = lh_rhythm_maker
     rh_pitch_range = rh_pitch_range or '[C4, C6]'
     rh_pitch_range = abjad.PitchRange(rh_pitch_range)
     self._rh_pitch_range = rh_pitch_range
     lh_pitch_range = lh_pitch_range or '[C2, C4)'
     lh_pitch_range = abjad.PitchRange(lh_pitch_range)
     self._lh_pitch_range = lh_pitch_range
     if include_layout_ly is not None:
         include_layout_ly = bool(include_layout_ly)
     self._include_layout_ly = include_layout_ly
def test_rhythmmakertools_NoteRhythmMaker___call___01():

    maker = rhythmmakertools.NoteRhythmMaker()

    divisions = [(5, 16), (3, 8)]
    result = maker(divisions)

    maker = abjad.MeasureMaker()
    measures = maker(divisions)
    staff = abjad.Staff(measures)
    abjad.mutate(staff).replace_measure_contents(result)

    assert format(staff) == abjad.String.normalize(
        r'''
        \new Staff
        {
            {   % measure
                \time 5/16
                c'4
                ~
                c'16
            }   % measure
            {   % measure
                \time 3/8
                c'4.
            }   % measure
        }
        '''
        )
def test_rhythmmakertools_NoteRhythmMaker___call___02():

    duration_specifier = rhythmmakertools.DurationSpecifier(
        decrease_monotonic=False,
        )
    maker = rhythmmakertools.NoteRhythmMaker(
        duration_specifier=duration_specifier,
        )

    divisions = [(5, 16), (3, 8)]
    result = maker(divisions)

    maker = abjad.MeasureMaker()
    measures = maker(divisions)
    staff = abjad.Staff(measures)
    abjad.mutate(staff).replace_measure_contents(result)

    assert format(staff) == abjad.String.normalize(
        r'''
        \new Staff
        {
            {   % measure
                \time 5/16
                c'16
                ~
                c'4
            }   % measure
            {   % measure
                \time 3/8
                c'4.
            }   % measure
        }
        '''
        )
Ejemplo n.º 5
0
        dynamic_expressions=consort.DynamicExpression(
            division_period=2,
            dynamic_tokens='pp mf p p mf mf pp',
            start_dynamic_tokens='fp niente',
            stop_dynamic_tokens='niente f',
        ),
        stem_tremolo_spanner=consort.AttachmentExpression(
            attachments=spannertools.StemTremoloSpanner(),
            selector=selectortools.select_pitched_runs(),
        ),
    ),
    color='red',
    pitch_handler=consort.AbsolutePitchHandler(
        logical_tie_expressions=[
            consort.ChordExpression(chord_expr=_, )
            for _ in abbreviations.guitar_chords
        ],
        pitch_specifier=consort.PitchSpecifier(
            pitch_segments=(
                'D3',
                'F3',
                'G2',
            ),
            ratio=(1, 1, 1),
        ),
    ),
    rhythm_maker=rhythmmakertools.NoteRhythmMaker(
        tie_specifier=rhythmmakertools.TieSpecifier(
            tie_across_divisions=True, ), ),
)
Ejemplo n.º 6
0
    pitch_handler=consort.AbsolutePitchHandler(
        deviations=(0, 0, 0, 0, 0.5, 0),
        forbid_repetitions=True,
        grace_expressions=(
            consort.HarmonicExpression('P4'),
            consort.HarmonicExpression('M3'),
            consort.HarmonicExpression('P5'),
        ),
        pitch_specifier=consort.PitchSpecifier(
            pitch_segments=(
                "a c' a a c'",
                "a g c' gs d'",
                "a c'",
            ),
            ratio=(1, 1, 1),
        ),
    ),
    rhythm_maker=consort.CompositeRhythmMaker(
        last=rhythmmakertools.NoteRhythmMaker(),
        default=rhythmmakertools.EvenDivisionRhythmMaker(
            denominators=(4, ),
            extra_counts_per_division=(0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1),
            duration_spelling_specifier=rhythmmakertools.
            DurationSpellingSpecifier(
                decrease_durations_monotonically=True,
                forbidden_written_duration=durationtools.Duration(1, 4),
            ),
        ),
    ),
)
Ejemplo n.º 7
0
# -*- encoding: utf-8 -*-
import consort
from abjad.tools import durationtools
from abjad.tools import rhythmmakertools
from abjad.tools import selectortools

left_hand_stasis_music_specifier = consort.MusicSpecifier(
    attachment_handler=consort.AttachmentHandler(
        trill_spanner=consort.AttachmentExpression(
            attachments=(
                consort.ConsortTrillSpanner(interval='+m3'),
                consort.ConsortTrillSpanner(interval='+P4'),
                consort.ConsortTrillSpanner(interval='+m3'),
            ),
            selector=selectortools.Selector().by_leaf(),
        ), ),
    minimum_phrase_duration=durationtools.Duration(1, 4),
    pitch_handler=consort.AbsolutePitchHandler(
        deviations=(0, 0, 0.5),
        pitch_specifier="gs'",
    ),
    rhythm_maker=rhythmmakertools.NoteRhythmMaker(
        duration_spelling_specifier=rhythmmakertools.DurationSpellingSpecifier(
            forbid_meter_rewriting=True, ), ),
)