metricmodulation

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.metricmodulation" { graph [label="abjad.metricmodulation"]; node [color=1]; "abjad.metricmodulation.MetricModulation" [URL="../api/abjad/metricmodulation.html#abjad.metricmodulation.MetricModulation", color=black, fontcolor=white, label="Metric\nModulation", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.10/library/functions.html#object", label=object, target=_top]; } "builtins.object" -> "abjad.metricmodulation.MetricModulation"; }


Classes

MetricModulation

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

__delattr__

Implement delattr(self, name).

__eq__

Is true when argument is another metric modulation with the same ratio as this metric modulation.

__hash__

Return hash(self).

__post_init__

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

directed

ratio

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:

bool

overridden __hash__()

Return hash(self).

__post_init__()[source]
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)