mutate

The mutate subpackage contains mutation functions. Mutations act on an input abjad.Selection, abjad.Container, or abjad.Leaf (depending on the function), transforming the input in place, having no return value. Auxjad automatically adds them as extension functions to abjad.mutate.

Note

All mutation functions are also added as extension functions to abjad.mutate, so it is possible to simply use abjad.mutate instead of auxjad.mutate:

>>> import abjad
>>> import auxjad
>>> abjad.mutate.rests_to_multimeasure_rest(container[:])

Below is the full list of functions included in mutate. Click on their names for their individual documentation.

auto_rewrite_meter(container[, meter_list, …])

Mutates an input container (of type abjad.Container or child class) in place and has no return value; this function takes every measure of a container, detects its time signature, and apply both abjad.Meter.rewrite_meter() and auxjad.mutate.prettify_rewrite_meter() to it.

close_container(container)

Mutates an input container (of type abjad.Container or child class) in place and has no return value; this function changes the time signature of the last measure of an underfull in order to make it full.

contract_notes(container, …[, …])

Mutates an input abjad.Container (or child class) in place and has no return value; this function contracts all logical ties (notes and chords) by a maximum contraction duration.

enforce_time_signature(container, …[, …])

Mutates an input container (of type abjad.Container or child class) in place and has no return value; this function applies a time signature (or a list of time signatures) to the input container.

extend_notes(container, max_note_duration, *)

Mutates an input abjad.Container (or child class) in place and has no return value; this function extends all logical ties (notes and chords) up to a given maximum note duration.

extract_trivial_tuplets(selection)

Mutates an input abjad.Selection in place and has no return value; this function looks for tuplets filled with rests or with tied notes or chords and replaces them with a single leaf.

fill_with_rests(container, *[, …])

Mutates an input container (of type abjad.Container or child class) in place and has no return value; this function fills a container with rests in order to make it full.

merge_hairpins(selection)

Mutates an input abjad.Selection in place and has no return value; this function merges all consecutive hairpins that share a same trend.

merge_partial_tuplets(selection, *[, …])

Mutates an input abjad.Selection in place and has no return value; this function merges all consecutive partial tuplets with the same ratio and which sum up to an assignable duration.

prettify_rewrite_meter(selection, meter, *)

Mutates an input abjad.Selection in place and has no return value; this function fuses pitched leaves according to the rules shown below, improving the default output of abjad.Meter.rewrite_meter().

remove_repeated_dynamics(selection, *[, …])

Mutates an input abjad.Selection in place and has no return value; this function removes all consecutive repeated dynamic markings.

remove_repeated_time_signatures(selection)

Mutates an input abjad.Selection in place and has no return value; this function removes all consecutive repeated time signatures.

reposition_clefs(selection, *[, …])

Mutates an input abjad.Selection in place and has no return value; this function removes all consecutive repeated clefs.

reposition_dynamics(selection, *[, …])

Mutates an input abjad.Selection in place and has no return value; this function shifts all dynamics from rests to the next pitched leaves.

reposition_slurs(selection, *[, …])

Mutates an input abjad.Selection in place and has no return value; this function repositions all slurs that starts or ends on rests.

respell_augmented_unisons(selection, *[, …])

Mutates an input abjad.Selection in place and has no return value; this function changes the accidentals of individual pitches of all chords in a container in order to avoid augmented unisons.

rests_to_multimeasure_rest(selection, *[, …])

Mutates an input abjad.Selection in place and has no return value; this function looks for measures filled with regular rests and converts them into an abjad.MultimeasureRest.

sustain_notes(container, *[, …])

Mutates an input container (of type abjad.Container or child class) in place and has no return value; this function will sustain all pitched leaves until the next pitched leaf, thus replacing all rests in between them.

sync_containers(containers, *[, …])

Mutates two or more input containers in place and has no return value; this function finds the longest container among the inputs and adds rests to all the shorter ones, making them the same length.