attackpointoptimizers

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_abc { graph [label=abc]; node [color=1]; "abc.ABC" [URL="https://docs.python.org/3.10/library/abc.html#abc.ABC", label=ABC, target=_top]; } subgraph "cluster_abjadext.nauert.attackpointoptimizers" { graph [label="abjadext.nauert.attackpointoptimizers"]; node [color=2]; "abjadext.nauert.attackpointoptimizers.AttackPointOptimizer" [URL="../api/abjadext/nauert/attackpointoptimizers.html#abjadext.nauert.attackpointoptimizers.AttackPointOptimizer", color=black, fontcolor=white, label="Attack\nPoint\nOptimizer", shape=oval, style="bold, filled", target=_top]; "abjadext.nauert.attackpointoptimizers.MeasurewiseAttackPointOptimizer" [URL="../api/abjadext/nauert/attackpointoptimizers.html#abjadext.nauert.attackpointoptimizers.MeasurewiseAttackPointOptimizer", color=black, fontcolor=white, label="Measurewise\nAttack\nPoint\nOptimizer", target=_top]; "abjadext.nauert.attackpointoptimizers.NaiveAttackPointOptimizer" [URL="../api/abjadext/nauert/attackpointoptimizers.html#abjadext.nauert.attackpointoptimizers.NaiveAttackPointOptimizer", color=black, fontcolor=white, label="Naive\nAttack\nPoint\nOptimizer", target=_top]; "abjadext.nauert.attackpointoptimizers.NullAttackPointOptimizer" [URL="../api/abjadext/nauert/attackpointoptimizers.html#abjadext.nauert.attackpointoptimizers.NullAttackPointOptimizer", color=black, fontcolor=white, label="Null\nAttack\nPoint\nOptimizer", target=_top]; "abjadext.nauert.attackpointoptimizers.AttackPointOptimizer" -> "abjadext.nauert.attackpointoptimizers.MeasurewiseAttackPointOptimizer"; "abjadext.nauert.attackpointoptimizers.AttackPointOptimizer" -> "abjadext.nauert.attackpointoptimizers.NaiveAttackPointOptimizer"; "abjadext.nauert.attackpointoptimizers.AttackPointOptimizer" -> "abjadext.nauert.attackpointoptimizers.NullAttackPointOptimizer"; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.10/library/functions.html#object", label=object, target=_top]; } "abc.ABC" -> "abjadext.nauert.attackpointoptimizers.AttackPointOptimizer"; "builtins.object" -> "abc.ABC"; }


Abstract Classes

AttackPointOptimizer

Abstract attack-point optimizer.

abstract class abjadext.nauert.attackpointoptimizers.AttackPointOptimizer[source]

Abstract attack-point optimizer.

Attack-point optimizers may alter the number, order, and individual durations of leaves in a logical tie, but may not alter the overall duration of that logical tie.

They effectively “clean up” notation, post-quantization.


Attributes Summary

__call__

Calls attack-point optimizer.


Special methods

overridden abstract __call__(argument)[source]

Calls attack-point optimizer.


Classes

MeasurewiseAttackPointOptimizer

Measurewise attack-point optimizer.

NaiveAttackPointOptimizer

Naive attack-point optimizer.

NullAttackPointOptimizer

Null attack-point optimizer.

class abjadext.nauert.attackpointoptimizers.MeasurewiseAttackPointOptimizer[source]

Measurewise attack-point optimizer.

Attempts to optimize attack points in an expression with regard to the effective time signature of that expression.

Only acts on measures.

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8 g'8 a'8 b'8 c''8")
>>> abjad.show(staff)  
>>> source_tempo = abjad.MetronomeMark(abjad.Duration(1, 4), 60)
>>> q_events = nauert.QEventSequence.from_tempo_scaled_leaves(
...     staff[:],
...     tempo=source_tempo,
... )
>>> target_tempo = abjad.MetronomeMark(abjad.Duration(1, 4), 54)
>>> q_schema = nauert.MeasurewiseQSchema(
...     tempo=target_tempo,
... )

Without the measure-wise attack-point optimizer:

>>> result = nauert.quantize(q_events, q_schema=q_schema)
>>> abjad.show(result)  

With the measure-wise attack-point optimizer:

>>> optimizer = nauert.MeasurewiseAttackPointOptimizer()
>>> result = nauert.quantize(
...     q_events,
...     attack_point_optimizer=optimizer,
...     q_schema=q_schema,
... )
>>> abjad.show(result)  

Attributes Summary

__call__

Calls measurewise attack-point optimizer.


Special methods

overridden __call__(argument, time_signature=None)[source]

Calls measurewise attack-point optimizer.

Return type:

None

class abjadext.nauert.attackpointoptimizers.NaiveAttackPointOptimizer[source]

Naive attack-point optimizer. (The default attack-point optimizer)

Optimizes attack points by fusing tie leaves within logical ties with leaf durations decreasing monotonically.

Logical ties will be partitioned into sub-logical-ties if leaves are found with metronome marks attached.

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8 g'8 a'8 b'8 c''8")
>>> abjad.show(staff)  
>>> source_tempo = abjad.MetronomeMark(abjad.Duration(1, 4), 60)
>>> q_events = nauert.QEventSequence.from_tempo_scaled_leaves(
...     staff[:],
...     tempo=source_tempo,
... )
>>> target_tempo = abjad.MetronomeMark(abjad.Duration(1, 4), 54)
>>> q_schema = nauert.MeasurewiseQSchema(
...     tempo=target_tempo,
... )
>>> optimizer = nauert.NaiveAttackPointOptimizer()
>>> result = nauert.quantize(
...     q_events,
...     attack_point_optimizer=optimizer,
...     q_schema=q_schema,
... )
>>> abjad.show(result)  

Attributes Summary

__call__

Calls naive attack-point optimizer.


Special methods

overridden __call__(argument)[source]

Calls naive attack-point optimizer.

class abjadext.nauert.attackpointoptimizers.NullAttackPointOptimizer[source]

Null attack-point optimizer.

Performs no attack point optimization.

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8 g'8 a'8 b'8 c''8")
>>> abjad.show(staff)  
>>> source_tempo = abjad.MetronomeMark(abjad.Duration(1, 4), 60)
>>> q_events = nauert.QEventSequence.from_tempo_scaled_leaves(
...     staff[:],
...     tempo=source_tempo,
... )
>>> target_tempo = abjad.MetronomeMark(abjad.Duration(1, 4), 54)
>>> q_schema = nauert.MeasurewiseQSchema(
...     tempo=target_tempo,
... )
>>> optimizer = nauert.NullAttackPointOptimizer()
>>> result = nauert.quantize(
...     q_events,
...     attack_point_optimizer=optimizer,
...     q_schema=q_schema,
... )
>>> abjad.show(result)  

Attributes Summary

__call__

Calls null attack-point optimizer.


Special methods

overridden __call__(argument)[source]

Calls null attack-point optimizer.