metricmodulation¶
Classes
Metric modulation. |
- class abjad.metricmodulation.MetricModulation(left_rhythm, right_rhythm, hide=False, left_markup=None, right_markup=None, scale=(1, 1))[source]¶
Metric modulation.
With notes:
>>> metric_modulation = abjad.MetricModulation( ... left_rhythm=abjad.Note("c'8."), ... right_rhythm=abjad.Note("c'4."), ... )
>>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', metric_modulation]) >>> abjad.show(lilypond_file)
With tuplets:
>>> metric_modulation = abjad.MetricModulation( ... left_rhythm=abjad.Tuplet((4, 5), "c'4"), ... right_rhythm=abjad.Note("c'4"), ... )
>>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', metric_modulation]) >>> abjad.show(lilypond_file)
>>> metric_modulation = abjad.MetricModulation( ... left_rhythm=abjad.Note("c'4"), ... right_rhythm=abjad.Tuplet((4, 5), "c'4"), ... )
>>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', metric_modulation]) >>> abjad.show(lilypond_file)
With tuplets again:
>>> metric_modulation = abjad.MetricModulation( ... left_rhythm=abjad.Note("c16."), ... right_rhythm=abjad.Tuplet((2, 3), "c8"), ... )
>>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', metric_modulation]) >>> abjad.show(lilypond_file)
With ties:
>>> notes = abjad.makers.make_notes([0], [(5, 16)]) >>> metric_modulation = abjad.MetricModulation( ... left_rhythm=abjad.Note("c'4"), ... right_rhythm=notes, ... )
>>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', metric_modulation]) >>> abjad.show(lilypond_file)
With ties and tuplets:
>>> notes = abjad.makers.make_notes([0], [(5, 16)]) >>> tuplet = abjad.Tuplet((2, 3), notes) >>> metric_modulation = abjad.MetricModulation( ... left_rhythm=abjad.Note("c'4"), ... right_rhythm=tuplet, ... )
>>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', metric_modulation]) >>> abjad.show(lilypond_file)
Attach metric modulations to generate score output:
>>> staff = abjad.Staff("c'4 d'4 e'4 f'4 e'4 d'4") >>> score = abjad.Score([staff], name="Score") >>> abjad.attach(abjad.TimeSignature((3, 4)), staff[0]) >>> metric_modulation = abjad.MetricModulation( ... left_rhythm=abjad.Note("c4"), ... right_rhythm=abjad.Note("c8."), ... ) >>> abjad.attach(metric_modulation, staff[3], direction=abjad.UP) >>> abjad.override(staff).TextScript.staff_padding = 2.5 >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', score]) >>> abjad.show(lilypond_file)
Attributes Summary
Implement delattr(self, name).
Is true when
argument
is another metric modulation with the same ratio as this metric modulation.Return hash(self).
Return repr(self).
Implement setattr(self, name, value).
directed
Gets ratio of metric modulation.
Special methods
- overridden __delattr__(name)¶
Implement delattr(self, name).
- overridden __eq__(argument)[source]¶
Is true when
argument
is another metric modulation with the same ratio as this metric modulation.>>> metric_modulation_1 = abjad.MetricModulation( ... left_rhythm=abjad.Note("c'4"), ... right_rhythm=abjad.Note("c'4."), ... ) >>> metric_modulation_2 = abjad.MetricModulation( ... left_rhythm=abjad.Tuplet((2, 3), [abjad.Note("c'4")]), ... right_rhythm=abjad.Note("c'4"), ... ) >>> notes = abjad.makers.make_notes([0], [(5, 16)]) >>> metric_modulation_3 = abjad.MetricModulation( ... left_rhythm=abjad.Note("c'4"), ... right_rhythm=notes, ... )
>>> metric_modulation_1.ratio (2, 3)
>>> metric_modulation_2.ratio (2, 3)
>>> metric_modulation_3.ratio (4, 5)
>>> metric_modulation_1 == metric_modulation_1 True
>>> metric_modulation_1 == metric_modulation_2 True
>>> metric_modulation_1 == metric_modulation_3 False
>>> metric_modulation_2 == metric_modulation_1 True
>>> metric_modulation_2 == metric_modulation_2 True
>>> metric_modulation_2 == metric_modulation_3 False
>>> metric_modulation_3 == metric_modulation_1 False
>>> metric_modulation_3 == metric_modulation_2 False
>>> metric_modulation_3 == metric_modulation_3 True
- Return type:
- overridden __hash__()¶
Return hash(self).
- overridden __repr__()¶
Return repr(self).
- overridden __setattr__(name, value)¶
Implement setattr(self, name, value).
Read-only properties
- ratio¶
Gets ratio of metric modulation.
>>> metric_modulation = abjad.MetricModulation( ... left_rhythm=abjad.Tuplet((2, 3), [abjad.Note("c'4")]), ... right_rhythm=abjad.Note("c'4"), ... ) >>> metric_modulation.ratio (2, 3)