From a973513c226b5ad434c788219a9857f6673d154a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trevor=20Ba=C4=8Da?= Date: Fri, 14 Jun 2024 15:30:22 -0400 Subject: [PATCH 1/2] Changed \times to \tuplet. Agrees with Abjad #1586. --- abjadext/nauert/__init__.py | 1 + abjadext/nauert/attackpointoptimizers.py | 80 ++++++++++++------- abjadext/nauert/gracehandlers.py | 22 +++-- abjadext/nauert/heuristics.py | 2 +- abjadext/nauert/qeventproxy.py | 2 +- abjadext/nauert/qevents.py | 8 +- abjadext/nauert/qeventsequence.py | 6 +- abjadext/nauert/qgrid.py | 2 +- abjadext/nauert/quantizationjob.py | 2 +- abjadext/nauert/quantizer.py | 18 ++--- abjadext/nauert/searchtrees.py | 2 +- tests/test_CollapsingGraceHandler___call__.py | 8 +- ...test_ConcatenatingGraceHandler___call__.py | 8 +- ...easurewiseAttackPointOptimizer___call__.py | 4 +- tests/test_QGrid___call__.py | 6 +- tests/test_Quantizer___call__.py | 32 ++++---- 16 files changed, 112 insertions(+), 91 deletions(-) diff --git a/abjadext/nauert/__init__.py b/abjadext/nauert/__init__.py index 26e8db5..2040dec 100644 --- a/abjadext/nauert/__init__.py +++ b/abjadext/nauert/__init__.py @@ -1,6 +1,7 @@ """ Extension for quantizing rhythm, based on Paul Nauert's Q-Grid technique. """ + from ._version import __version__, __version_info__ from .attackpointoptimizers import ( AttackPointOptimizer, diff --git a/abjadext/nauert/attackpointoptimizers.py b/abjadext/nauert/attackpointoptimizers.py index 34702da..fffe730 100644 --- a/abjadext/nauert/attackpointoptimizers.py +++ b/abjadext/nauert/attackpointoptimizers.py @@ -64,24 +64,27 @@ class MeasurewiseAttackPointOptimizer(AttackPointOptimizer): \new Voice { { - \tempo 4=54 %%% \time 4/4 %%% + \tempo 4=54 c'16.. d'64 ~ - \times 4/5 { + \tuplet 5/4 + { d'8 e'32 ~ } - \times 4/7 { + \tuplet 7/4 + { e'8 ~ e'32 f'16 ~ } - \times 4/5 { + \tuplet 5/4 + { f'16. g'16 ~ @@ -89,19 +92,22 @@ class MeasurewiseAttackPointOptimizer(AttackPointOptimizer): g'16 a'16 ~ - \times 4/5 { + \tuplet 5/4 + { a'16 b'16. ~ } - \times 4/7 { + \tuplet 7/4 + { b'16 c''8 ~ c''32 ~ } - \times 4/5 { + \tuplet 5/4 + { c''32 r32 r32 @@ -130,26 +136,29 @@ class MeasurewiseAttackPointOptimizer(AttackPointOptimizer): \new Voice { { - \tempo 4=54 %%% \time 4/4 %%% + \tempo 4=54 c'16.. d'64 ~ - \times 4/5 { + \tuplet 5/4 + { d'16. ~ d'32 e'32 ~ } - \times 4/7 { + \tuplet 7/4 + { e'16. ~ e'16 f'16 ~ } - \times 4/5 { + \tuplet 5/4 + { f'16. g'16 ~ @@ -157,21 +166,24 @@ class MeasurewiseAttackPointOptimizer(AttackPointOptimizer): g'16 a'16 ~ - \times 4/5 { + \tuplet 5/4 + { a'16 b'32 ~ b'16 ~ } - \times 4/7 { + \tuplet 7/4 + { b'16 c''32 ~ c''8 ~ } - \times 4/5 { + \tuplet 5/4 + { c''32 r16 r16 @@ -246,24 +258,27 @@ class NaiveAttackPointOptimizer(AttackPointOptimizer): \new Voice { { - \tempo 4=54 %%% \time 4/4 %%% + \tempo 4=54 c'16.. d'64 ~ - \times 4/5 { + \tuplet 5/4 + { d'8 e'32 ~ } - \times 4/7 { + \tuplet 7/4 + { e'8 ~ e'32 f'16 ~ } - \times 4/5 { + \tuplet 5/4 + { f'16. g'16 ~ @@ -271,19 +286,22 @@ class NaiveAttackPointOptimizer(AttackPointOptimizer): g'16 a'16 ~ - \times 4/5 { + \tuplet 5/4 + { a'16 b'16. ~ } - \times 4/7 { + \tuplet 7/4 + { b'16 c''8 ~ c''32 ~ } - \times 4/5 { + \tuplet 5/4 + { c''32 r32 r32 @@ -366,8 +384,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): \new Voice { { - \tempo 4=54 %%% \time 4/4 %%% + \tempo 4=54 c'16 ~ c'32 @@ -375,7 +393,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): c'64 d'64 ~ - \times 4/5 { + \tuplet 5/4 + { d'32 ~ d'32 @@ -386,7 +405,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): e'32 ~ } - \times 4/7 { + \tuplet 7/4 + { e'32 ~ e'32 @@ -401,7 +421,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): f'32 ~ } - \times 4/5 { + \tuplet 5/4 + { f'32 ~ f'32 @@ -415,7 +436,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): g'16 a'16 ~ - \times 4/5 { + \tuplet 5/4 + { a'32 ~ a'32 @@ -426,7 +448,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): b'32 ~ } - \times 4/7 { + \tuplet 7/4 + { b'32 ~ b'32 @@ -441,7 +464,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): c''32 ~ } - \times 4/5 { + \tuplet 5/4 + { c''32 r32 r32 diff --git a/abjadext/nauert/gracehandlers.py b/abjadext/nauert/gracehandlers.py index 1068c9b..62a2bdd 100644 --- a/abjadext/nauert/gracehandlers.py +++ b/abjadext/nauert/gracehandlers.py @@ -33,9 +33,7 @@ def __init__(self): ### SPECIAL METHODS ### @abc.abstractmethod - def __call__( - self, q_events - ) -> tuple[ + def __call__(self, q_events) -> tuple[ tuple[abjad.NamedPitch, ...], typing.Optional[tuple], typing.Optional[abjad.BeforeGraceContainer], @@ -73,8 +71,8 @@ class CollapsingGraceHandler(GraceHandler): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 4 r4 @@ -134,8 +132,8 @@ class ConcatenatingGraceHandler(GraceHandler): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 \grace { d'16 @@ -167,8 +165,8 @@ class ConcatenatingGraceHandler(GraceHandler): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 c'4 r4 @@ -192,8 +190,8 @@ class ConcatenatingGraceHandler(GraceHandler): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 \grace { r16 @@ -229,8 +227,8 @@ class ConcatenatingGraceHandler(GraceHandler): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 \grace { c'16 @@ -258,8 +256,8 @@ class ConcatenatingGraceHandler(GraceHandler): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 c'4 c'4 @@ -295,9 +293,7 @@ def __init__( ### SPECIAL METHODS ### - def __call__( - self, q_events: typing.Sequence[QEvent] - ) -> tuple[ + def __call__(self, q_events: typing.Sequence[QEvent]) -> tuple[ tuple[abjad.NamedPitch, ...], typing.Optional[tuple], typing.Optional[abjad.BeforeGraceContainer], @@ -485,8 +481,8 @@ class DiscardingGraceHandler(GraceHandler): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 cs'4 r4 diff --git a/abjadext/nauert/heuristics.py b/abjadext/nauert/heuristics.py index c52bb04..7be5680 100644 --- a/abjadext/nauert/heuristics.py +++ b/abjadext/nauert/heuristics.py @@ -74,8 +74,8 @@ class DistanceHeuristic(Heuristic): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 cs'4 d'4 diff --git a/abjadext/nauert/qeventproxy.py b/abjadext/nauert/qeventproxy.py index fefd5ac..39eb247 100644 --- a/abjadext/nauert/qeventproxy.py +++ b/abjadext/nauert/qeventproxy.py @@ -58,7 +58,7 @@ def __eq__(self, argument) -> bool: Is true when `argument` is a q-event proxy with offset and q-event equal to those of this q-event proxy. Otherwise false. """ - if type(self) == type(argument): + if type(self) is type(argument): if self.offset == argument.offset: if self.q_event == argument.q_event: return True diff --git a/abjadext/nauert/qevents.py b/abjadext/nauert/qevents.py index d9fca37..cc77f05 100644 --- a/abjadext/nauert/qevents.py +++ b/abjadext/nauert/qevents.py @@ -40,7 +40,7 @@ def __lt__(self, argument) -> bool: Is true when `epxr` is a q-event with offset greater than that of this q-event. Otherwise false. """ - if type(self) == type(self): + if type(self) is type(self): if self.offset < argument.offset: return True return False @@ -120,7 +120,7 @@ def __eq__(self, argument) -> bool: false. """ if ( - type(self) == type(argument) + type(self) is type(argument) and self.offset == argument.offset and self.pitches == argument.pitches and self.attachments == argument.attachments @@ -199,7 +199,7 @@ def __eq__(self, argument) -> bool: and index equal to those of this silent q-event. Otherwise false. """ if ( - type(self) == type(argument) + type(self) is type(argument) and self._offset == argument._offset and self._attachments == argument._attachments and self._index == argument._index @@ -252,7 +252,7 @@ def __eq__(self, argument) -> bool: Is true when `argument` is a terminal q-event with offset equal to that of this terminal q-event. Otherwise false. """ - if type(self) == type(argument) and self.offset == argument.offset: + if type(self) is type(argument) and self.offset == argument.offset: return True return False diff --git a/abjadext/nauert/qeventsequence.py b/abjadext/nauert/qeventsequence.py index d887e3e..263b960 100644 --- a/abjadext/nauert/qeventsequence.py +++ b/abjadext/nauert/qeventsequence.py @@ -75,18 +75,18 @@ def __eq__(self, argument) -> bool: """ Is true when q-event sequence equals ``argument``. Otherwise false. """ - if type(self) == type(argument): + if type(self) is type(argument): if self.sequence == argument.sequence: return True return False @typing.overload def __getitem__(self, argument: int) -> QEvent: - ... + pass @typing.overload def __getitem__(self, argument: slice) -> tuple[QEvent, ...]: - ... + pass def __getitem__(self, argument: int | slice) -> QEvent | tuple[QEvent, ...]: """ diff --git a/abjadext/nauert/qgrid.py b/abjadext/nauert/qgrid.py index 9506d09..4f0ef5f 100644 --- a/abjadext/nauert/qgrid.py +++ b/abjadext/nauert/qgrid.py @@ -267,7 +267,7 @@ def __eq__(self, argument) -> bool: Returns true or false. """ - if type(self) == type(argument): + if type(self) is type(argument): if self.root_node == argument.root_node: if self.next_downbeat == argument.next_downbeat: return True diff --git a/abjadext/nauert/quantizationjob.py b/abjadext/nauert/quantizationjob.py index d8cccca..49dd703 100644 --- a/abjadext/nauert/quantizationjob.py +++ b/abjadext/nauert/quantizationjob.py @@ -113,7 +113,7 @@ def __eq__(self, argument) -> bool: q-event proxies and q-grids equal to those of this quantization job. Otherwise false. """ - if type(self) == type(argument): + if type(self) is type(argument): if self.job_id == argument.job_id: if self.search_tree == argument.search_tree: if self.q_event_proxies == argument.q_event_proxies: diff --git a/abjadext/nauert/quantizer.py b/abjadext/nauert/quantizer.py index 6452a57..9ae8863 100644 --- a/abjadext/nauert/quantizer.py +++ b/abjadext/nauert/quantizer.py @@ -106,31 +106,31 @@ def quantize( \time 2/4 c'4 ~ - \times 4/5 { + \tuplet 5/4 { c'16. cs'8.. ~ } } { - \times 4/7 { + \tuplet 7/4 { \tempo 8=57 \time 5/4 cs'16. d'8 ~ } - \times 4/5 { + \tuplet 5/4 { d'16 ef'16. ~ } - \times 2/3 { + \tuplet 3/2 { ef'16 e'8 ~ } - \times 4/7 { + \tuplet 7/4 { e'16 f'8 ~ @@ -140,12 +140,12 @@ def quantize( f'32 fs'16. ~ - \times 4/5 { + \tuplet 5/4 { fs'32 g'8 ~ } - \times 4/7 { + \tuplet 7/4 { g'32 r32 r16 @@ -206,7 +206,7 @@ def quantize( ~ e'16 ~ - \times 2/3 { + \tuplet 3/2 { \tempo 4=30 e'32 f'8. @@ -215,7 +215,7 @@ def quantize( fs'32 ~ } - \times 2/3 { + \tuplet 3/2 { fs'32 g'8. r32 diff --git a/abjadext/nauert/searchtrees.py b/abjadext/nauert/searchtrees.py index 781ae19..7bc61b8 100644 --- a/abjadext/nauert/searchtrees.py +++ b/abjadext/nauert/searchtrees.py @@ -53,7 +53,7 @@ def __eq__(self, argument) -> bool: Is true when `argument` is a search tree with definition equal to that of this search tree. Otherwise false. """ - if type(self) == type(argument): + if type(self) is type(argument): if self.definition == argument.definition: return True return False diff --git a/tests/test_CollapsingGraceHandler___call__.py b/tests/test_CollapsingGraceHandler___call__.py index b7bcb27..84fb5e8 100644 --- a/tests/test_CollapsingGraceHandler___call__.py +++ b/tests/test_CollapsingGraceHandler___call__.py @@ -15,8 +15,8 @@ def test_CollapsingGraceHandler___call___01(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 4 r4 @@ -40,8 +40,8 @@ def test_CollapsingGraceHandler___call___02(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 4 r4 @@ -65,8 +65,8 @@ def test_CollapsingGraceHandler___call___03(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 4 r4 @@ -90,8 +90,8 @@ def test_CollapsingGraceHandler___call___04(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 4 r4 diff --git a/tests/test_ConcatenatingGraceHandler___call__.py b/tests/test_ConcatenatingGraceHandler___call__.py index 6fb8aad..40021e8 100644 --- a/tests/test_ConcatenatingGraceHandler___call__.py +++ b/tests/test_ConcatenatingGraceHandler___call__.py @@ -15,8 +15,8 @@ def test_ConcatenatingGraceHandler___call___01(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 c'4 r4 @@ -40,8 +40,8 @@ def test_ConcatenatingGraceHandler___call___02(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 \grace { r16 @@ -70,8 +70,8 @@ def test_ConcatenatingGraceHandler___call___03(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 \grace { c'16 @@ -100,8 +100,8 @@ def test_ConcatenatingGraceHandler___call___04(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 c'4 c'4 c'4 diff --git a/tests/test_MeasurewiseAttackPointOptimizer___call__.py b/tests/test_MeasurewiseAttackPointOptimizer___call__.py index 42ef7e1..2e15f3a 100644 --- a/tests/test_MeasurewiseAttackPointOptimizer___call__.py +++ b/tests/test_MeasurewiseAttackPointOptimizer___call__.py @@ -4,7 +4,7 @@ def test_MeasurewiseAttackPointOptimizer___call___01(): string = r""" - \times 8/11 + \tuplet 11/8 { a''8 ~ @@ -39,7 +39,7 @@ def test_MeasurewiseAttackPointOptimizer___call___01(): assert string == abjad.string.normalize( r""" { - \times 8/11 + \tuplet 11/8 { a''2.. \grace { diff --git a/tests/test_QGrid___call__.py b/tests/test_QGrid___call__.py index 608e5f9..bd1b944 100644 --- a/tests/test_QGrid___call__.py +++ b/tests/test_QGrid___call__.py @@ -61,12 +61,12 @@ def test_QGrid___call___02(): assert isinstance(result, list) and len(result) == 1 assert abjad.lilypond(result[0]) == abjad.string.normalize( r""" - \times 2/3 + \tuplet 3/2 { c'8 c'16 c'16 - \times 2/3 + \tuplet 3/2 { c'16 c'16 @@ -132,7 +132,7 @@ def test_QGrid___call___03(): assert abjad.lilypond(result[0]) == abjad.string.normalize( r""" \tweak edge-height #'(0.7 . 0) - \times 2/3 + \tuplet 3/2 { c'4 c'4 diff --git a/tests/test_Quantizer___call__.py b/tests/test_Quantizer___call__.py index 7331c34..85f3d65 100644 --- a/tests/test_Quantizer___call__.py +++ b/tests/test_Quantizer___call__.py @@ -205,7 +205,7 @@ def test_Quantize_05(): c'16 } c'8 - \times 2/3 + \tuplet 3/2 { c'8 \grace { @@ -214,7 +214,7 @@ def test_Quantize_05(): c'8 c'8 } - \times 4/5 + \tuplet 5/4 { c'16 c'16 @@ -223,7 +223,7 @@ def test_Quantize_05(): c'16 c'16 } - \times 4/7 + \tuplet 7/4 { c'16 ~ @@ -361,7 +361,7 @@ def test_Quantize_08(): c'16 } c'8 - \times 2/3 + \tuplet 3/2 { c'8 \grace { @@ -370,14 +370,14 @@ def test_Quantize_08(): c'8 c'8 } - \times 4/5 + \tuplet 5/4 { c'16 c'16 c'8 c'16 } - \times 4/7 + \tuplet 7/4 { c'8 c'16 @@ -434,8 +434,8 @@ def test_Quantize_10(): \new Voice { { - \tempo 4=60 %%% \time 4/4 %%% + \tempo 4=60 4 4 4 @@ -541,7 +541,7 @@ def test_Quantize_12(): { { \tweak text #tuplet-number::calc-fraction-text - \times 6/7 + \tuplet 7/6 { \tempo 4=60 \time 7/8 @@ -550,7 +550,7 @@ def test_Quantize_12(): ~ cs'16 } - \times 4/7 + \tuplet 7/4 { \grace { d'16 @@ -563,7 +563,7 @@ def test_Quantize_12(): } } { - \times 4/5 + \tuplet 5/4 { e'8 r32 @@ -600,9 +600,9 @@ def test_Quantize_13(): { { \tweak text #tuplet-number::calc-fraction-text - \times 7/10 + \tuplet 10/7 { - \times 4/7 + \tuplet 7/4 { \tempo 4=60 \time 7/8 @@ -612,7 +612,7 @@ def test_Quantize_13(): cs'8 } \tweak text #tuplet-number::calc-fraction-text - \times 3/5 + \tuplet 5/3 { d'2. ef'2 @@ -620,7 +620,7 @@ def test_Quantize_13(): } } { - \times 4/5 + \tuplet 5/4 { \grace { e'16 @@ -780,7 +780,7 @@ def test_Quantize_16(): { { \tweak text #tuplet-number::calc-fraction-text - \times 5/7 + \tuplet 7/5 { \tempo 4=72 \time 7/8 @@ -793,7 +793,7 @@ def test_Quantize_16(): ~ } { - \times 4/5 + \tuplet 5/4 { ef'16 e'32 From afc78cebbfa344ec2835ad3ff324f5dafc87516e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trevor=20Ba=C4=8Da?= Date: Fri, 14 Jun 2024 15:30:22 -0400 Subject: [PATCH 2/2] Changed \times to \tuplet. Agrees with Abjad #1586. --- abjadext/nauert/attackpointoptimizers.py | 72 ++++++++++++------- abjadext/nauert/quantizer.py | 18 ++--- ...easurewiseAttackPointOptimizer___call__.py | 54 ++++++++++++++ tests/test_QGrid___call__.py | 6 +- tests/test_Quantizer___call__.py | 30 ++++---- tests/test_attack_point_optimizers.py | 4 +- 6 files changed, 131 insertions(+), 53 deletions(-) create mode 100644 tests/test_MeasurewiseAttackPointOptimizer___call__.py diff --git a/abjadext/nauert/attackpointoptimizers.py b/abjadext/nauert/attackpointoptimizers.py index cdf8437..b7713a9 100644 --- a/abjadext/nauert/attackpointoptimizers.py +++ b/abjadext/nauert/attackpointoptimizers.py @@ -69,19 +69,22 @@ class MeasurewiseAttackPointOptimizer(AttackPointOptimizer): c'16.. d'64 ~ - \times 4/5 { + \tuplet 5/4 + { d'8 e'32 ~ } - \times 4/7 { + \tuplet 7/4 + { e'8 ~ e'32 f'16 ~ } - \times 4/5 { + \tuplet 5/4 + { f'16. g'16 ~ @@ -89,19 +92,22 @@ class MeasurewiseAttackPointOptimizer(AttackPointOptimizer): g'16 a'16 ~ - \times 4/5 { + \tuplet 5/4 + { a'16 b'16. ~ } - \times 4/7 { + \tuplet 7/4 + { b'16 c''8 ~ c''32 ~ } - \times 4/5 { + \tuplet 5/4 + { c''32 r32 r32 @@ -135,21 +141,24 @@ class MeasurewiseAttackPointOptimizer(AttackPointOptimizer): c'16.. d'64 ~ - \times 4/5 { + \tuplet 5/4 + { d'16. ~ d'32 e'32 ~ } - \times 4/7 { + \tuplet 7/4 + { e'16. ~ e'16 f'16 ~ } - \times 4/5 { + \tuplet 5/4 + { f'16. g'16 ~ @@ -157,21 +166,24 @@ class MeasurewiseAttackPointOptimizer(AttackPointOptimizer): g'16 a'16 ~ - \times 4/5 { + \tuplet 5/4 + { a'16 b'32 ~ b'16 ~ } - \times 4/7 { + \tuplet 7/4 + { b'16 c''32 ~ c''8 ~ } - \times 4/5 { + \tuplet 5/4 + { c''32 r16 r16 @@ -273,19 +285,22 @@ class NaiveAttackPointOptimizer(AttackPointOptimizer): c'16.. d'64 ~ - \times 4/5 { + \tuplet 5/4 + { d'8 e'32 ~ } - \times 4/7 { + \tuplet 7/4 + { e'8 ~ e'32 f'16 ~ } - \times 4/5 { + \tuplet 5/4 + { f'16. g'16 ~ @@ -293,19 +308,22 @@ class NaiveAttackPointOptimizer(AttackPointOptimizer): g'16 a'16 ~ - \times 4/5 { + \tuplet 5/4 + { a'16 b'16. ~ } - \times 4/7 { + \tuplet 7/4 + { b'16 c''8 ~ c''32 ~ } - \times 4/5 { + \tuplet 5/4 + { c''32 r32 r32 @@ -397,7 +415,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): c'64 d'64 ~ - \times 4/5 { + \tuplet 5/4 + { d'32 ~ d'32 @@ -408,7 +427,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): e'32 ~ } - \times 4/7 { + \tuplet 7/4 + { e'32 ~ e'32 @@ -423,7 +443,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): f'32 ~ } - \times 4/5 { + \tuplet 5/4 + { f'32 ~ f'32 @@ -437,7 +458,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): g'16 a'16 ~ - \times 4/5 { + \tuplet 5/4 + { a'32 ~ a'32 @@ -448,7 +470,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): b'32 ~ } - \times 4/7 { + \tuplet 7/4 + { b'32 ~ b'32 @@ -463,7 +486,8 @@ class NullAttackPointOptimizer(AttackPointOptimizer): c''32 ~ } - \times 4/5 { + \tuplet 5/4 + { c''32 r32 r32 diff --git a/abjadext/nauert/quantizer.py b/abjadext/nauert/quantizer.py index 6452a57..9ae8863 100644 --- a/abjadext/nauert/quantizer.py +++ b/abjadext/nauert/quantizer.py @@ -106,31 +106,31 @@ def quantize( \time 2/4 c'4 ~ - \times 4/5 { + \tuplet 5/4 { c'16. cs'8.. ~ } } { - \times 4/7 { + \tuplet 7/4 { \tempo 8=57 \time 5/4 cs'16. d'8 ~ } - \times 4/5 { + \tuplet 5/4 { d'16 ef'16. ~ } - \times 2/3 { + \tuplet 3/2 { ef'16 e'8 ~ } - \times 4/7 { + \tuplet 7/4 { e'16 f'8 ~ @@ -140,12 +140,12 @@ def quantize( f'32 fs'16. ~ - \times 4/5 { + \tuplet 5/4 { fs'32 g'8 ~ } - \times 4/7 { + \tuplet 7/4 { g'32 r32 r16 @@ -206,7 +206,7 @@ def quantize( ~ e'16 ~ - \times 2/3 { + \tuplet 3/2 { \tempo 4=30 e'32 f'8. @@ -215,7 +215,7 @@ def quantize( fs'32 ~ } - \times 2/3 { + \tuplet 3/2 { fs'32 g'8. r32 diff --git a/tests/test_MeasurewiseAttackPointOptimizer___call__.py b/tests/test_MeasurewiseAttackPointOptimizer___call__.py new file mode 100644 index 0000000..2e15f3a --- /dev/null +++ b/tests/test_MeasurewiseAttackPointOptimizer___call__.py @@ -0,0 +1,54 @@ +import abjad +from abjadext import nauert + + +def test_MeasurewiseAttackPointOptimizer___call___01(): + string = r""" + \tuplet 11/8 + { + a''8 + ~ + a''8 + ~ + a''8 + ~ + a''8 + ~ + a''8 + ~ + a''8 + ~ + a''8 + \grace { + e''16 + e''16 + } + d''8 + ~ + d''8 + r8 + r8 + } + """ + string = abjad.string.normalize(string) + container = abjad.Container(string) + time_signature = abjad.TimeSignature((4, 4)) + attack_point_optimizer = nauert.MeasurewiseAttackPointOptimizer() + attack_point_optimizer(container, time_signature) + string = abjad.lilypond(container) + assert string == abjad.string.normalize( + r""" + { + \tuplet 11/8 + { + a''2.. + \grace { + e''16 + e''16 + } + d''4 + r4 + } + } + """ + ), print(string) diff --git a/tests/test_QGrid___call__.py b/tests/test_QGrid___call__.py index 608e5f9..bd1b944 100644 --- a/tests/test_QGrid___call__.py +++ b/tests/test_QGrid___call__.py @@ -61,12 +61,12 @@ def test_QGrid___call___02(): assert isinstance(result, list) and len(result) == 1 assert abjad.lilypond(result[0]) == abjad.string.normalize( r""" - \times 2/3 + \tuplet 3/2 { c'8 c'16 c'16 - \times 2/3 + \tuplet 3/2 { c'16 c'16 @@ -132,7 +132,7 @@ def test_QGrid___call___03(): assert abjad.lilypond(result[0]) == abjad.string.normalize( r""" \tweak edge-height #'(0.7 . 0) - \times 2/3 + \tuplet 3/2 { c'4 c'4 diff --git a/tests/test_Quantizer___call__.py b/tests/test_Quantizer___call__.py index eeeee16..85f3d65 100644 --- a/tests/test_Quantizer___call__.py +++ b/tests/test_Quantizer___call__.py @@ -205,7 +205,7 @@ def test_Quantize_05(): c'16 } c'8 - \times 2/3 + \tuplet 3/2 { c'8 \grace { @@ -214,7 +214,7 @@ def test_Quantize_05(): c'8 c'8 } - \times 4/5 + \tuplet 5/4 { c'16 c'16 @@ -223,7 +223,7 @@ def test_Quantize_05(): c'16 c'16 } - \times 4/7 + \tuplet 7/4 { c'16 ~ @@ -361,7 +361,7 @@ def test_Quantize_08(): c'16 } c'8 - \times 2/3 + \tuplet 3/2 { c'8 \grace { @@ -370,14 +370,14 @@ def test_Quantize_08(): c'8 c'8 } - \times 4/5 + \tuplet 5/4 { c'16 c'16 c'8 c'16 } - \times 4/7 + \tuplet 7/4 { c'8 c'16 @@ -541,7 +541,7 @@ def test_Quantize_12(): { { \tweak text #tuplet-number::calc-fraction-text - \times 6/7 + \tuplet 7/6 { \tempo 4=60 \time 7/8 @@ -550,7 +550,7 @@ def test_Quantize_12(): ~ cs'16 } - \times 4/7 + \tuplet 7/4 { \grace { d'16 @@ -563,7 +563,7 @@ def test_Quantize_12(): } } { - \times 4/5 + \tuplet 5/4 { e'8 r32 @@ -600,9 +600,9 @@ def test_Quantize_13(): { { \tweak text #tuplet-number::calc-fraction-text - \times 7/10 + \tuplet 10/7 { - \times 4/7 + \tuplet 7/4 { \tempo 4=60 \time 7/8 @@ -612,7 +612,7 @@ def test_Quantize_13(): cs'8 } \tweak text #tuplet-number::calc-fraction-text - \times 3/5 + \tuplet 5/3 { d'2. ef'2 @@ -620,7 +620,7 @@ def test_Quantize_13(): } } { - \times 4/5 + \tuplet 5/4 { \grace { e'16 @@ -780,7 +780,7 @@ def test_Quantize_16(): { { \tweak text #tuplet-number::calc-fraction-text - \times 5/7 + \tuplet 7/5 { \tempo 4=72 \time 7/8 @@ -793,7 +793,7 @@ def test_Quantize_16(): ~ } { - \times 4/5 + \tuplet 5/4 { ef'16 e'32 diff --git a/tests/test_attack_point_optimizers.py b/tests/test_attack_point_optimizers.py index 1d7bd3c..40321c6 100644 --- a/tests/test_attack_point_optimizers.py +++ b/tests/test_attack_point_optimizers.py @@ -4,7 +4,7 @@ def test_MeasurewiseAttackPointOptimizer___call___01(): string = r""" - \times 8/11 + \tuplet 11/8 { a''8 ~ @@ -39,7 +39,7 @@ def test_MeasurewiseAttackPointOptimizer___call___01(): assert string == abjad.string.normalize( r""" { - \times 8/11 + \tuplet 11/8 { a''2.. \grace {