-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bump version * tell spg to generate some intensities * bump pang's commit * use abjad.Dynamic as attachment instead * generate music * find dynamic instead of assuming the first position * add a unit test for dynamics * reformat
- Loading branch information
Showing
14 changed files
with
519 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import abjad | ||
|
||
|
||
def do_dynamics(voice: abjad.Component) -> None: | ||
current_dynamic: abjad.Dynamic | None = None | ||
for logical_tie in abjad.iterate.logical_ties(voice, pitched=True): | ||
current_dynamic = _do_dynamics(logical_tie, current_dynamic) | ||
|
||
|
||
def _do_dynamics( | ||
logical_tie: abjad.LogicalTie, previous_dynamic: abjad.Dynamic | None | ||
) -> abjad.Dynamic: | ||
leaf = abjad.get.leaf(logical_tie, 0) | ||
current_dynamic = next( | ||
attachment | ||
for attachment in abjad.get.annotation(leaf, "q_event_attachments") | ||
if isinstance(attachment, abjad.Dynamic) | ||
) | ||
if current_dynamic != previous_dynamic: | ||
abjad.attach(current_dynamic, leaf) | ||
return current_dynamic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.