コード例 #1
0
 def __init__(
     self,
     denominators=[8],
     extra_counts_per_division=None,
     beam_specifier=None,
     duration_spelling_specifier=None,
     tie_specifier=None,
     tuplet_spelling_specifier=None,
     ):
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         tie_specifier=tie_specifier,
         tuplet_spelling_specifier=tuplet_spelling_specifier,
         )
     assert mathtools.all_are_nonnegative_integer_powers_of_two(
         denominators), repr(denominators)
     denominators = tuple(denominators)
     self._denominators = denominators
     if extra_counts_per_division is not None:
         assert mathtools.all_are_integer_equivalent_exprs(
             extra_counts_per_division), repr(extra_counts_per_division)
         extra_counts_per_division = [
             int(_) for _ in extra_counts_per_division
             ]
         extra_counts_per_division = tuple(extra_counts_per_division)
     self._extra_counts_per_division = extra_counts_per_division
コード例 #2
0
 def __init__(
     self,
     duration_spelling_specifier=None,
     ):
     RhythmMaker.__init__(
         self,
         duration_spelling_specifier=duration_spelling_specifier,
         )
コード例 #3
0
ファイル: IncisedRhythmMaker.py プロジェクト: adorsk/abjad
    def __init__(
        self,
        incise_specifier=None,
        body_ratio=None,
        prolation_addenda=None,
        secondary_divisions=None,
        helper_functions=None,
        decrease_durations_monotonically=True,
        forbidden_written_duration=None,
        beam_each_cell=False,
        beam_cells_together=False,
        fill_with_notes=True,
        incise_divisions=False,
        incise_output=False,
        ):
        from abjad.tools import rhythmmakertools
        RhythmMaker.__init__(
            self,
            beam_cells_together=beam_cells_together,
            beam_each_cell=beam_each_cell,
            decrease_durations_monotonically=decrease_durations_monotonically,
            forbidden_written_duration=forbidden_written_duration,
            )
        incise_specifier = incise_specifier or \
            rhythmmakertools.InciseSpecifier()
        self._incise_specifier = incise_specifier
        prolation_addenda = \
            self._to_tuple(prolation_addenda)
        secondary_divisions = \
            self._to_tuple(secondary_divisions)

        if helper_functions is not None:
            assert isinstance(helper_functions, dict)
            for name in helper_functions:
                function = helper_functions.get(name)
                assert callable(function)
        self._helper_functions = helper_functions
        assert prolation_addenda is None or \
            sequencetools.all_are_nonnegative_integer_equivalent_numbers(
            prolation_addenda), prolation_addenda
        assert secondary_divisions is None or \
            sequencetools.all_are_nonnegative_integer_equivalent_numbers(
            secondary_divisions), secondary_divisions
        self._prolation_addenda = prolation_addenda
        if body_ratio is not None:
            body_ratio = mathtools.Ratio(body_ratio)
        self._body_ratio = body_ratio
        self._secondary_divisions = secondary_divisions
        assert isinstance(fill_with_notes, bool)
        self._fill_with_notes = fill_with_notes
        assert isinstance(incise_divisions, bool)
        self._incise_divisions = incise_divisions
        assert isinstance(incise_output, bool)
        self._incise_output = incise_output
コード例 #4
0
 def __init__(
     self,
     beam_specifier=None,
     duration_spelling_specifier=None,
     tie_specifier=None,
     ):
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         tie_specifier=tie_specifier,
         )
コード例 #5
0
 def __init__(
     self,
     denominator_multiplier_exponent=0,
     beam_each_cell=True,
     beam_cells_together=False,
     ):
     assert mathtools.is_nonnegative_integer(
         denominator_multiplier_exponent)
     RhythmMaker.__init__(self,
         beam_each_cell=beam_each_cell,
         beam_cells_together=beam_cells_together
         )
     self._denominator_multiplier_exponent = \
         denominator_multiplier_exponent
コード例 #6
0
ファイル: RestRhythmMaker.py プロジェクト: adorsk/abjad
 def __init__(
     self,
     beam_each_cell=False,
     beam_cells_together=False,
     decrease_durations_monotonically=True,
     forbidden_written_duration=None,
     ):
     RhythmMaker.__init__(
         self,
         beam_each_cell=beam_each_cell,
         beam_cells_together=beam_cells_together,
         decrease_durations_monotonically=decrease_durations_monotonically,
         forbidden_written_duration=forbidden_written_duration,
         )
コード例 #7
0
 def __init__(
     self,
     leaf_count=None,
     is_diminution=True,
     beam_each_cell=True,
     beam_cells_together=False,
     ):
     assert mathtools.is_integer_equivalent_expr(leaf_count)
     RhythmMaker.__init__(self,
         beam_each_cell=beam_each_cell,
         beam_cells_together=beam_cells_together
         )
     leaf_count = int(leaf_count)
     self._leaf_count = leaf_count
     self._is_diminution = is_diminution
コード例 #8
0
    def new(self, **kwargs):
        r'''Create new tuplet monad rhythm-maker with `kwargs`:

        ::

            >>> new_maker = maker.new()

        ::

            >>> print new_maker.storage_format
            rhythmmakertools.TupletMonadRhythmMaker(
                beam_each_cell=False,
                beam_cells_together=False
                )

        ::

            >>> divisions = [(2, 5), (2, 5), (1, 4), (1, 5), (3, 4)]
            >>> tuplet_lists = new_maker(divisions)
            >>> tuplets = sequencetools.flatten_sequence(tuplet_lists)
            >>> staff = stafftools.RhythmicStaff(tuplets)

        ::

            >>> show(staff) # doctest: +SKIP

        Returns new tuplet monad rhythm-maker.
        '''
        return RhythmMaker.new(self, **kwargs)
コード例 #9
0
    def reverse(self):
        r'''Reverse tuplet monad rhythm-maker:

        ::

            >>> reversed_maker = maker.reverse()

        ::

            >>> print reversed_maker.storage_format
            rhythmmakertools.TupletMonadRhythmMaker(
                beam_each_cell=False,
                beam_cells_together=False
                )

        ::

            >>> divisions = [(2, 5), (2, 5), (1, 4), (1, 5), (3, 4)]
            >>> tuplet_lists = reversed_maker(divisions)
            >>> tuplets = sequencetools.flatten_sequence(tuplet_lists)
            >>> staff = stafftools.RhythmicStaff(tuplets)

        ::

            >>> show(staff) # doctest: +SKIP

        Returns new tuplet monad rhythm-maker.
        '''
        return RhythmMaker.reverse(self)
コード例 #10
0
    def __eq__(self, arg):
        r'''True when `arg` is a note rhythm-maker with values of
        `beam_specifier`, `duration_spelling_specifier` and `tie_specifier`
        equal to those of this note rhythm-maker. Otherwise false.

        ..  container:: example

            ::

                >>> maker_1 = rhythmmakertools.NoteRhythmMaker()
                >>> tie_specifier = rhythmmakertools.TieSpecifier(
                ...     tie_across_divisions=True,
                ...     )
                >>> maker_2 = rhythmmakertools.NoteRhythmMaker(
                ...     tie_specifier=tie_specifier,
                ...     )

            ::

                >>> maker_1 == maker_1
                True
                >>> maker_1 == maker_2
                False
                >>> maker_2 == maker_1
                False
                >>> maker_2 == maker_2
                True

        Returns boolean.
        '''
        return RhythmMaker.__eq__(self, arg)
コード例 #11
0
ファイル: SkipRhythmMaker.py プロジェクト: Alwnikrotikz/abjad
    def new(self, **kwargs):
        r'''Create new skip rhythm-maker with `kwargs`:

        ::

            >>> new_maker = maker.new()

        ::

            >>> print new_maker.storage_format
            rhythmmakertools.SkipRhythmMaker()

        ::

            >>> divisions = [(1, 4), (3, 16), (5, 8)]
            >>> leaf_lists = new_maker(divisions)
            >>> music = sequencetools.flatten_sequence(leaf_lists)
            >>> measures = \
            ...     measuretools.make_measures_with_full_measure_spacer_skips(
            ...     divisions)
            >>> staff = stafftools.RhythmicStaff(measures)
            >>> measures = measuretools.replace_contents_of_measures_in_expr(
            ...     staff, music)

        ::

            >>> show(staff) # doctest: +SKIP

        Returns new skip rhythm-maker.
        '''
        return RhythmMaker.new(self, **kwargs)
コード例 #12
0
    def reverse(self):
        r'''Reverses tuplet monad rhythm-maker.

        ..  container:: example

            ::

                >>> reversed_maker = maker.reverse()

            ::

                >>> print format(reversed_maker)
                rhythmmakertools.TupletMonadRhythmMaker(
                    beam_cells_together=False,
                    beam_each_cell=True,
                    decrease_durations_monotonically=True,
                    )

            ::

                >>> divisions = [(2, 5), (2, 5), (1, 4), (1, 5), (3, 4)]
                >>> music = maker(divisions)
                >>> lilypond_file = rhythmmakertools.make_lilypond_file(
                ...     music,
                ...     divisions,
                ...     )
                >>> show(lilypond_file) # doctest: +SKIP

        Returns new tuplet monad rhythm-maker.
        '''
        return RhythmMaker.reverse(self)
コード例 #13
0
ファイル: TaleaRhythmMaker.py プロジェクト: adorsk/abjad
    def __call__(self, divisions, seeds=None):
        r'''Calls talea rhythm-maker on `divisions`.

        Returns either list of tuplets or else list of note-lists.
        '''
        duration_pairs, seeds = RhythmMaker.__call__(self, divisions, seeds)
        octuplet = self._prepare_input(seeds)
        talea, prolation_addenda = octuplet[:2]
        secondary_divisions = octuplet[-1]
        taleas = (talea, prolation_addenda, secondary_divisions)
        result = self._scale_taleas(
            duration_pairs, self.talea_denominator, taleas)
        duration_pairs, lcd, talea, prolation_addenda, secondary_divisions = \
            result
        secondary_duration_pairs = self._make_secondary_duration_pairs(
            duration_pairs, secondary_divisions)
        septuplet = (talea, prolation_addenda) + octuplet[2:-1]
        numeric_map = self._make_numeric_map(
            secondary_duration_pairs, septuplet)
        leaf_lists = self._make_leaf_lists(numeric_map, lcd)
        if not prolation_addenda:
            result = leaf_lists
        else:
            tuplets = self._make_tuplets(secondary_duration_pairs, leaf_lists)
            result = tuplets
        if self.beam_each_cell:
            for cell in result:
                beam = spannertools.MultipartBeam()
                attach(beam, cell)
        if self.tie_split_notes:
            self._add_ties(result)
        assert isinstance(result, list), repr(result)
        assert all(isinstance(x, selectiontools.Selection) for x in result) or \
            all(isinstance(x, scoretools.Tuplet) for x in result)
        return result
コード例 #14
0
ファイル: NoteRhythmMaker.py プロジェクト: DnMllr/abjad
    def __eq__(self, arg):
        r'''True when `arg` is a note rhythm-maker with values of
        `beam_specifier`, `duration_spelling_specifier` and `tie_specifier`
        equal to those of this note rhythm-maker. Otherwise false.

        ..  container:: example

            ::

                >>> maker_1 = rhythmmakertools.NoteRhythmMaker()
                >>> tie_specifier = rhythmmakertools.TieSpecifier(
                ...     tie_across_divisions=True,
                ...     )
                >>> maker_2 = rhythmmakertools.NoteRhythmMaker(
                ...     tie_specifier=tie_specifier,
                ...     )

            ::

                >>> maker_1 == maker_1
                True
                >>> maker_1 == maker_2
                False
                >>> maker_2 == maker_1
                False
                >>> maker_2 == maker_2
                True

        Returns true or false.
        '''
        return RhythmMaker.__eq__(self, arg)
コード例 #15
0
    def new(self, **kwargs):
        r'''Create new even-run rhythm-maker with `kwargs`:

        ::

            >>> new_maker = maker.new(denominator_multiplier_exponent=0)

        ::

            >>> print new_maker.storage_format
            rhythmmakertools.EvenRunRhythmMaker(
                denominator_multiplier_exponent=0,
                beam_each_cell=True,
                beam_cells_together=False
                )

        ::

            >>> divisions = [(4, 8), (3, 4), (2, 4)]
            >>> lists = new_maker(divisions)
            >>> music = sequencetools.flatten_sequence(lists)
            >>> measures = \
            ...     measuretools.make_measures_with_full_measure_spacer_skips(
            ...     divisions)
            >>> staff = stafftools.RhythmicStaff(measures)
            >>> measures = measuretools.replace_contents_of_measures_in_expr(
            ...     staff, music)

        ::

            >>> show(staff) # doctest: +SKIP

        Returns new even-run rhythm-maker.
        '''
        return RhythmMaker.new(self, **kwargs)
コード例 #16
0
ファイル: EvenRunRhythmMaker.py プロジェクト: adorsk/abjad
    def __makenew__(self, *args, **kwargs):
        r'''Makes new even-run rhythm-maker with `kwargs`.

        ..  container:: example

            ::

                >>> new_maker = new(maker, denominator_multiplier_exponent=0)

            ::

                >>> print format(new_maker)
                rhythmmakertools.EvenRunRhythmMaker(
                    denominator_multiplier_exponent=0,
                    beam_cells_together=False,
                    beam_each_cell=True,
                    decrease_durations_monotonically=True,
                    )

            ::

                >>> divisions = [(4, 8), (3, 4), (2, 4)]
                >>> music = maker(divisions)
                >>> lilypond_file = rhythmmakertools.make_lilypond_file(
                ...     music,
                ...     divisions,
                ...     )
                >>> show(lilypond_file) # doctest: +SKIP

        Returns new even-run rhythm-maker.
        '''
        return RhythmMaker.__makenew__(self, *args, **kwargs)
コード例 #17
0
ファイル: RestRhythmMaker.py プロジェクト: adorsk/abjad
    def __makenew__(self, *args, **kwargs):
        r'''Makes new rest rhythm-maker with `kwargs`.

        ..  container:: example

            ::

                >>> new_maker = new(maker)

            ::

                >>> print format(new_maker)
                rhythmmakertools.RestRhythmMaker(
                    beam_each_cell=False,
                    beam_cells_together=False,
                    decrease_durations_monotonically=True,
                    forbidden_written_duration=durationtools.Duration(1, 4),
                    )

            ::

                >>> divisions = [(5, 16), (3, 8)]
                >>> music = maker(divisions)
                >>> lilypond_file = rhythmmakertools.make_lilypond_file(
                ...     music,
                ...     divisions,
                ...     )
                >>> show(lilypond_file) # doctest: +SKIP

        Returns new rest rhythm-maker.
        '''
        return RhythmMaker.__makenew__(self, *args, **kwargs)
コード例 #18
0
ファイル: RestRhythmMaker.py プロジェクト: adorsk/abjad
    def reverse(self):
        r'''Reverses rest rhythm-maker.

        ..  container:: example

            ::

                >>> reversed_maker = maker.reverse()

            ::

                >>> print format(reversed_maker)
                rhythmmakertools.RestRhythmMaker(
                    beam_each_cell=False,
                    beam_cells_together=False,
                    decrease_durations_monotonically=True,
                    forbidden_written_duration=durationtools.Duration(1, 4),
                    )

            ::

                >>> divisions = [(5, 16), (3, 8)]
                >>> music = maker(divisions)
                >>> lilypond_file = rhythmmakertools.make_lilypond_file(
                ...     music,
                ...     divisions,
                ...     )
                >>> show(lilypond_file) # doctest: +SKIP

        Returns new rest rhythm-maker.
        '''
        return RhythmMaker.reverse(self)
コード例 #19
0
    def __makenew__(self, *args, **kwargs):
        r'''Makes new tuplet monad rhythm-maker with `kwargs`.

        ..  container:: example

            ::

                >>> new_maker = new(maker)

            ::

                >>> print format(new_maker)
                rhythmmakertools.TupletMonadRhythmMaker(
                    beam_cells_together=False,
                    beam_each_cell=True,
                    decrease_durations_monotonically=True,
                    )

            ::

                >>> divisions = [(2, 5), (2, 5), (1, 4), (1, 5), (3, 4)]
                >>> music = maker(divisions)
                >>> lilypond_file = rhythmmakertools.make_lilypond_file(
                ...     music,
                ...     divisions,
                ...     )
                >>> show(lilypond_file) # doctest: +SKIP

        Returns new tuplet monad rhythm-maker.
        '''
        return RhythmMaker.__makenew__(self, *args, **kwargs)
コード例 #20
0
 def __init__(
     self,
     exponent=None,
     beam_specifier=None,
     duration_spelling_specifier=None,
     tie_specifier=None,
     ):
     if exponent is not None:
         assert mathtools.is_nonnegative_integer(exponent)
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         tie_specifier=tie_specifier,
         )
     self._exponent = exponent
コード例 #21
0
 def __init__(
     self,
     exponent=None,
     beam_specifier=None,
     duration_spelling_specifier=None,
     tie_specifier=None,
     tuplet_spelling_specifier=None,
 ):
     if exponent is not None:
         assert mathtools.is_nonnegative_integer(exponent)
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         tie_specifier=tie_specifier,
         tuplet_spelling_specifier=tuplet_spelling_specifier,
     )
     self._exponent = exponent
コード例 #22
0
ファイル: IncisedRhythmMaker.py プロジェクト: DnMllr/abjad
 def __init__(
     self,
     beam_specifier=None,
     duration_spelling_specifier=None,
     division_masks=None,
     extra_counts_per_division=None,
     incise_specifier=None,
     logical_tie_masks=None,
     split_divisions_by_counts=None,
     tie_specifier=None,
     tuplet_spelling_specifier=None,
     helper_functions=None,
     ):
     from abjad.tools import rhythmmakertools
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         division_masks=division_masks,
         logical_tie_masks=logical_tie_masks,
         tie_specifier=tie_specifier,
         tuplet_spelling_specifier=tuplet_spelling_specifier,
         )
     prototype = (rhythmmakertools.InciseSpecifier, type(None))
     assert isinstance(incise_specifier, prototype)
     self._incise_specifier = incise_specifier
     if extra_counts_per_division is not None:
         extra_counts_per_division = tuple(extra_counts_per_division)
     if split_divisions_by_counts is not None:
         split_divisions_by_counts = tuple(split_divisions_by_counts)
     assert extra_counts_per_division is None or \
         mathtools.all_are_nonnegative_integer_equivalent_numbers(
         extra_counts_per_division), extra_counts_per_division
     assert split_divisions_by_counts is None or \
         mathtools.all_are_nonnegative_integer_equivalent_numbers(
         split_divisions_by_counts), split_divisions_by_counts
     self._extra_counts_per_division = extra_counts_per_division
     self._split_divisions_by_counts = split_divisions_by_counts
     if helper_functions is not None:
         assert isinstance(helper_functions, dict)
         for name in helper_functions:
             function = helper_functions.get(name)
             assert callable(function)
     self._helper_functions = helper_functions
コード例 #23
0
ファイル: SkipRhythmMaker.py プロジェクト: tchiwinpiti/abjad
    def __call__(self, divisions, previous_state=None):
        r'''Calls skip rhythm-maker on `divisions`.

        Returns list of selections.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            previous_state=previous_state,
        )
コード例 #24
0
ファイル: IncisedRhythmMaker.py プロジェクト: odub/abjad
    def __call__(self, divisions, rotation=None):
        r'''Calls incised rhythm-maker on `divisions`.

        Returns list of selections.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            rotation=rotation,
        )
コード例 #25
0
ファイル: IncisedRhythmMaker.py プロジェクト: rulio/abjad
    def __call__(self, divisions, seeds=None):
        r'''Calls incised rhythm-maker on `divisions`.

        Returns list of selections.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            seeds=seeds,
            )
コード例 #26
0
    def __call__(self, divisions, seeds=None):
        r'''Calls skip rhythm-maker on `divisions`.

        Returns list of selections.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            seeds=seeds,
        )
コード例 #27
0
ファイル: SkipRhythmMaker.py プロジェクト: mscuthbert/abjad
    def __call__(self, divisions, rotation=None):
        r'''Calls skip rhythm-maker on `divisions`.

        Returns list of selections.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            rotation=rotation,
            )
コード例 #28
0
ファイル: EvenRunRhythmMaker.py プロジェクト: adorsk/abjad
 def __init__(
     self,
     denominator_multiplier_exponent=0,
     beam_cells_together=False,
     beam_each_cell=True,
     decrease_durations_monotonically=True,
     forbidden_written_duration=None,
     ):
     assert mathtools.is_nonnegative_integer(
         denominator_multiplier_exponent)
     RhythmMaker.__init__(
         self,
         beam_cells_together=beam_cells_together,
         beam_each_cell=beam_each_cell,
         decrease_durations_monotonically=decrease_durations_monotonically,
         forbidden_written_duration=forbidden_written_duration,
         )
     self._denominator_multiplier_exponent = \
         denominator_multiplier_exponent
コード例 #29
0
ファイル: IncisedRhythmMaker.py プロジェクト: odub/abjad
 def __init__(
     self,
     incise_specifier=None,
     split_divisions_by_counts=None,
     extra_counts_per_division=None,
     beam_specifier=None,
     duration_spelling_specifier=None,
     output_masks=None,
     tie_specifier=None,
     tuplet_spelling_specifier=None,
     helper_functions=None,
 ):
     from abjad.tools import rhythmmakertools
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         output_masks=output_masks,
         tie_specifier=tie_specifier,
         tuplet_spelling_specifier=tuplet_spelling_specifier,
     )
     prototype = (rhythmmakertools.InciseSpecifier, type(None))
     assert isinstance(incise_specifier, prototype)
     self._incise_specifier = incise_specifier
     extra_counts_per_division = \
         self._to_tuple(extra_counts_per_division)
     split_divisions_by_counts = \
         self._to_tuple(split_divisions_by_counts)
     assert extra_counts_per_division is None or \
         mathtools.all_are_nonnegative_integer_equivalent_numbers(
         extra_counts_per_division), extra_counts_per_division
     assert split_divisions_by_counts is None or \
         mathtools.all_are_nonnegative_integer_equivalent_numbers(
         split_divisions_by_counts), split_divisions_by_counts
     self._extra_counts_per_division = extra_counts_per_division
     self._split_divisions_by_counts = split_divisions_by_counts
     if helper_functions is not None:
         assert isinstance(helper_functions, dict)
         for name in helper_functions:
             function = helper_functions.get(name)
             assert callable(function)
     self._helper_functions = helper_functions
コード例 #30
0
ファイル: IncisedRhythmMaker.py プロジェクト: adorsk/abjad
    def __call__(self, divisions, seeds=None):
        r'''Calls incised rhythm-maker on `divisions`.

        Returns list of tuplets or return list of leaf lists.
        '''
        duration_pairs, seeds = RhythmMaker.__call__(self, divisions, seeds)
        result = self._prepare_input(seeds)
        prefix_talea, prefix_lengths, suffix_talea, suffix_lengths = \
            result[:-2]
        prolation_addenda, secondary_divisions = result[-2:]
        taleas = (
            prefix_talea, 
            suffix_talea, 
            prolation_addenda, 
            secondary_divisions,
            )
        result = self._scale_taleas(
            duration_pairs, 
            self.incise_specifier.talea_denominator, 
            taleas,
            )
        duration_pairs, lcd, prefix_talea, suffix_talea = result[:-2]
        prolation_addenda, secondary_divisions = result[-2:]
        secondary_duration_pairs = self._make_secondary_duration_pairs(
            duration_pairs, secondary_divisions)
        if self.incise_divisions:
            numeric_map = self._make_division_incised_numeric_map(
                secondary_duration_pairs,
                prefix_talea,
                prefix_lengths,
                suffix_talea,
                suffix_lengths,
                prolation_addenda,
                )
        else:
            assert self.incise_output
            numeric_map = self._make_output_incised_numeric_map(
                secondary_duration_pairs,
                prefix_talea,
                prefix_lengths,
                suffix_talea,
                suffix_lengths,
                prolation_addenda,
                )
        leaf_lists = self._numeric_map_and_talea_denominator_to_leaf_lists(
            numeric_map, lcd)
        if not self.prolation_addenda:
            result = leaf_lists
        else:
            tuplets = self._make_tuplets(secondary_duration_pairs, leaf_lists)
            result = tuplets
        assert self._all_are_tuplets_or_all_are_leaf_lists(
            result), repr(result)
        return result
コード例 #31
0
 def __init__(
     self,
     leaf_count=1,
     is_diminution=True,
     beam_cells_together=False,
     beam_each_cell=True,
     decrease_durations_monotonically=True,
     forbidden_written_duration=None,
     ):
     RhythmMaker.__init__(
         self,
         beam_cells_together=beam_cells_together,
         beam_each_cell=beam_each_cell,
         decrease_durations_monotonically=decrease_durations_monotonically,
         forbidden_written_duration=forbidden_written_duration,
         )
     assert mathtools.is_integer_equivalent_expr(leaf_count)
     leaf_count = int(leaf_count)
     self._leaf_count = leaf_count
     self._is_diminution = is_diminution
コード例 #32
0
 def __init__(
     self,
     tuplet_ratios=((1, 1), (1, 2), (1, 3)),
     beam_specifier=None,
     duration_spelling_specifier=None,
     tie_specifier=None,
     tuplet_spelling_specifier=None,
     ):
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         tie_specifier=tie_specifier,
         )
     from abjad.tools import rhythmmakertools
     prototype = (rhythmmakertools.TupletSpellingSpecifier, type(None))
     assert isinstance(tuplet_spelling_specifier, prototype)
     if tuplet_ratios is not None:
         tuplet_ratios = tuple(mathtools.Ratio(x) for x in tuplet_ratios)
     self._tuplet_ratios = tuplet_ratios
     self._tuplet_spelling_specifier = tuplet_spelling_specifier
コード例 #33
0
ファイル: NoteRhythmMaker.py プロジェクト: DnMllr/abjad
    def __repr__(self):
        r'''Gets interpreter representation of note rhythm-maker.

        ..  container:: example

            ::

                >>> rhythmmakertools.NoteRhythmMaker()
                NoteRhythmMaker()

        Returns string.
        '''
        return RhythmMaker.__repr__(self)
コード例 #34
0
 def __init__(
     self,
     beam_specifier=None,
     burnish_specifier=None,
     duration_spelling_specifier=None,
     output_masks=None,
     tie_specifier=None,
     tuplet_spelling_specifier=None,
     ):
     from abjad.tools import rhythmmakertools
     RhythmMaker.__init__(
         self,
         beam_specifier=beam_specifier,
         duration_spelling_specifier=duration_spelling_specifier,
         output_masks=output_masks,
         tie_specifier=tie_specifier,
         tuplet_spelling_specifier=tuplet_spelling_specifier,
         )
     if burnish_specifier is not None:
         prototype = rhythmmakertools.BurnishSpecifier
         assert isinstance(burnish_specifier, prototype)
     self._burnish_specifier = burnish_specifier
コード例 #35
0
    def __repr__(self):
        r'''Gets interpreter representation of note rhythm-maker.

        ..  container:: example

            ::

                >>> rhythmmakertools.NoteRhythmMaker()
                NoteRhythmMaker()

        Returns string.
        '''
        return RhythmMaker.__repr__(self)
コード例 #36
0
ファイル: NoteRhythmMaker.py プロジェクト: odub/abjad
    def __call__(self, divisions, rotation=None):
        r"""Calls note rhythm-maker on `divisions`.

        ..  container:: example

            **Example 1.** Calls rhythm-maker on divisions:

            ::

                >>> maker = rhythmmakertools.NoteRhythmMaker()
                >>> divisions = [(5, 8), (3, 8)]
                >>> result = maker(divisions)
                >>> for x in result:
                ...     x
                Selection(Note("c'2"), Note("c'8"))
                Selection(Note("c'4."),)

        Returns list of selections. Each selection holds one or more notes.
        """
        return RhythmMaker.__call__(self, divisions, rotation=rotation)
コード例 #37
0
    def __call__(self, divisions, seeds=None):
        r'''Calls note rhythm-maker on `divisions`.

        ..  container:: example

            ::

                >>> maker = rhythmmakertools.NoteRhythmMaker()
                >>> divisions = [(5, 8), (3, 8)]
                >>> result = maker(divisions)
                >>> for x in result:
                ...     x
                Selection(Note("c'2"), Note("c'8"))
                Selection(Note("c'4."),)

        Returns list of selections. Each selection holds one or more notes.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            seeds=seeds,
            )
コード例 #38
0
    def __call__(self, divisions, seeds=None):
        r'''Calls note rhythm-maker on `divisions`.

        ..  container:: example

            ::

                >>> maker = rhythmmakertools.NoteRhythmMaker()
                >>> divisions = [(5, 8), (3, 8)]
                >>> result = maker(divisions)
                >>> for x in result:
                ...     x
                Selection(Note("c'2"), Note("c'8"))
                Selection(Note("c'4."),)

        Returns list of selections. Each selection holds one or more notes.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            seeds=seeds,
            )
コード例 #39
0
    def __call__(self, divisions, rotation=None):
        r'''Calls note rhythm-maker on `divisions`.

        ..  container:: example

            **Example 1.** Calls rhythm-maker on divisions:

            ::

                >>> rhythm_maker = rhythmmakertools.NoteRhythmMaker()
                >>> divisions = [(5, 8), (3, 8)]
                >>> result = rhythm_maker(divisions)
                >>> for x in result:
                ...     x
                Selection([Note("c'2"), Note("c'8")])
                Selection([Note("c'4.")])

        Returns list of selections. Each selection holds one or more notes.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            rotation=rotation,
        )
コード例 #40
0
    def __call__(self, divisions, seeds=None):
        r'''Calls even-run rhythm-maker on `divisions`.

        ..  container:: example

            ::

                >>> maker = rhythmmakertools.EvenRunRhythmMaker()
                >>> divisions = [(4, 8), (3, 4), (2, 4)]
                >>> result = maker(divisions)
                >>> for selection in result:
                ...     selection
                Selection(Container("c'8 c'8 c'8 c'8"),)
                Selection(Container("c'4 c'4 c'4"),)
                Selection(Container("c'4 c'4"),)

        Returns a list of selections. Each selection holds a single container
        filled with notes.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            seeds=seeds,
        )
コード例 #41
0
    def __call__(self, divisions, seeds=None):
        r'''Calls even division rhythm-maker on `divisions`.

        ..  container:: example

                >>> maker = rhythmmakertools.EvenDivisionRhythmMaker(
                ...     denominators=[16, 16, 8],
                ...     extra_counts_per_division=[1, 0],
                ...     )

            ::

                >>> divisions = [(3, 8), (4, 8), (3, 8), (4, 8)]
                >>> selections = maker(divisions)

            ::

                >>> for selection in selections:
                ...     selection
                Selection(FixedDurationTuplet(Duration(3, 8), "c'16 c'16 c'16 c'16 c'16 c'16 c'16"),)
                Selection(FixedDurationTuplet(Duration(1, 2), "c'16 c'16 c'16 c'16 c'16 c'16 c'16 c'16"),)
                Selection(FixedDurationTuplet(Duration(3, 8), "c'8 c'8 c'8 c'8"),)
                Selection(FixedDurationTuplet(Duration(1, 2), "c'16 c'16 c'16 c'16 c'16 c'16 c'16 c'16"),)

            ::

                >>> lilypond_file = rhythmmakertools.make_lilypond_file(
                ...     selections,
                ...     divisions,
                ...     )
                >>> show(lilypond_file) # doctest: +SKIP

            ..  doctest::

                >>> staff = maker._get_rhythmic_staff(lilypond_file)
                >>> f(staff)
                \new RhythmicStaff {
                    {
                        \time 3/8
                        \tweak #'text #tuplet-number::calc-fraction-text
                        \times 6/7 {
                            c'16 [
                            c'16
                            c'16
                            c'16
                            c'16
                            c'16
                            c'16 ]
                        }
                    }
                    {
                        \time 4/8
                        {
                            c'16 [
                            c'16
                            c'16
                            c'16
                            c'16
                            c'16
                            c'16
                            c'16 ]
                        }
                    }
                    {
                        \time 3/8
                        \tweak #'text #tuplet-number::calc-fraction-text
                        \times 3/4 {
                            c'8 [
                            c'8
                            c'8
                            c'8 ]
                        }
                    }
                    {
                        \time 4/8
                        {
                            c'16 [
                            c'16
                            c'16
                            c'16
                            c'16
                            c'16
                            c'16
                            c'16 ]
                        }
                    }
                }

        Returns list of of selections.
        '''
        return RhythmMaker.__call__(
            self,
            divisions,
            seeds=seeds,
            )