containertools.scale_contents_of_container

abjad.tools.containertools.scale_contents_of_container.scale_contents_of_container(container, multiplier)[source]

New in version 1.1.

Scale contents of container by dot multiplier:

abjad> staff = Staff("c'8 d'8")
abjad> spannertools.BeamSpanner(staff.leaves)
BeamSpanner(c'8, d'8)
abjad> f(staff)
\new Staff {
    c'8 [
    d'8 ]
}
abjad> containertools.scale_contents_of_container(staff, Duration(3, 2))
Staff{2}
abjad> f(staff)
\new Staff {
    c'8. [
    d'8. ]
}

Scale contents of container by tie multiplier:

abjad> staff = Staff("c'8 d'8")
abjad> spannertools.BeamSpanner(staff.leaves)
BeamSpanner(c'8, d'8)
abjad> f(staff)
\new Staff {
    c'8 [
    d'8 ]
}
abjad> containertools.scale_contents_of_container(staff, Duration(5, 4))
Staff{4}
abjad> f(staff)
\new Staff {
    c'8 [ ~
    c'32
    d'8 ~
    d'32 ]
}

Scale contents of container by nonbinary multiplier:

abjad> staff = Staff("c'8 d'8")
abjad> spannertools.BeamSpanner(staff.leaves)
BeamSpanner(c'8, d'8)
abjad> f(staff)
\new Staff {
    c'8 [
    d'8 ]
}
abjad> containertools.scale_contents_of_container(staff, Duration(4, 3))
Staff{2}
abjad> f(staff)
\new Staff {
    \times 2/3 {
        c'4 [
    }
    \times 2/3 {
        d'4 ]
    }
}

Return container.

Changed in version 2.0: renamed containertools.contents_scale() to containertools.scale_contents_of_container().

This Page