TempoProportional

class abjad.TempoProportional(music=None, indication=None)

Bases: abjad.tempo.spanner.Tempo

New in version 1.1.1.

Tempo spanner aware of score-global spacing.

abjad> t = Score([Staff(construct.scale(4))])   
abjad> tempo_indication = TempoIndication(Rational(1, 4), 60)   
abjad> spacing_indication = SpacingIndication(tempo_indication, Rational(1, 34))   
abjad> t.global_spacing = spacing_indication   
abjad> print t.format
\new Score <<
        \new Staff {
                c'8
                d'8
                e'8
                f'8
        }
>>
abjad> p = TempoProportional(t[0][:2])   
abjad> p.indication = TempoIndication(Rational(1, 4), 60)   
abjad> p = TempoProportional(t[0][2:])   
abjad> p.indication = TempoIndication(Rational(1, 4), 120)
abjad> print t.format
\new Score <<
        \new Staff {
                \tempo 4=60
                \newSpacingSection
                \set Score.proportionalNotationDuration = #(ly:make-moment 1 34)
                c'8
                d'8
                %% tempo 4=60 ends here
                \tempo 4=120
                \newSpacingSection
                \set Score.proportionalNotationDuration = #(ly:make-moment 1 17)
                e'8
                f'8
                %% tempo 4=120 ends here
        }
>>
append(component)

Add component to right of spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[:2])
abjad> spanner
Spanner(c'8, d'8)
abjad> spanner.append(voice[2])
abjad> spanner
Spanner(c'8, d'8, e'8)
append_left(component)

Add component to left of spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[2:])
abjad> spanner
Spanner(e'8, f'8)
abjad> spanner.append_left(voice[1])
abjad> spanner
Spanner(d'8, e'8, f'8)
clear()

Remove all components from spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[:])
abjad> spanner
Spanner(c'8, d'8, e'8, f'8)
abjad> spanner.clear( )
abjad> spanner
Spanner( )
components

Return read-only tuple of components in spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[:2])
abjad> spanner.components
(Note(c', 8), Note(d', 8))

Changed in version 1.1.1: Now returns an (immutable) tuple instead of a (mutable) list.

duration

Return read-only reference to spanner duration interface.

Spanner duration interface implements written, preprolated and prolated attributes.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[:2])
abjad> spanner
Spanner(c'8, d'8, e'8, f'8)
abjad> spanner.duration.written
Rational(1, 2)
abjad> spanner.duration.preprolated
Rational(1, 2)
abjad> spanner.duration.prolated
Rational(1, 2)

Spanner duration interface also implements seconds attribute.

abjad> Tempo(voice[:], TempoIndication(Rational(1, 8), 48))
abjad> spanner.duration.seconds
Rational(5, 1)
extend(components)

Add iterable components to right of spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice([:2])
abjad> spanner
Spanner(c'8, d'8)
abjad> spanner.extend(voice[2:])
abjad> spanner
Spanner(c'8, d'8, e'8, f'8)
extend_left(components)

Add iterable components to left of spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice([2:])
abjad> spanner
Spanner(e'8, f'8)
abjad> spanner.extend_left(voice[:2])
abjad> spanner
Spanner(c'8, d'8, e'8, f'8)
fracture(i, direction='both')

Fracture spanner at direction of component at index i.

Valid values for direction are 'left', 'right' and 'both'.

Return original, left and right spanners.

abjad> voice = Voice(construct.scale(4))
abjad> beam = Beam(voice[:])
abjad> beam
Beam(c'8, d'8, e'8, f'8)
abjad> beam.fracture(1, direction = 'left')
(Beam(c'8, d'8, e'8, f'8), Beam(c'8), Beam(d'8, e'8, f'8))
abjad> print voice.format
\new Voice {
        c'8 [ ]
        d'8 [
        e'8
        f'8 ]
}
fuse(spanner)

Fuse contiguous spanners.

Return new spanner.

abjad> voice = Voice(construct.scale(4))
abjad> left_beam = Beam(t[:2])
abjad> right_beam = Beam(t[2:])
abjad> print voice.format
\new Voice {
        c'8 [
        d'8 ]
        e'8 [
        f'8 ]
}
abjad> left_beam.fuse(right_beam)
[(Beam(c'8, d'8), Beam(e'8, f'8), Beam(c'8, d'8, e'8, f'8))]
abjad> print voice.format 
\new Voice {
        c'8 [
        d'8
        e'8
        f'8 ]
}

Todo

Return (immutable) tuple instead of (mutable) list.

index(component)

Return nonnegative integer index of component in spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[2:])
abjad> spanner
Spanner(e'8, f'8)
abjad> spanner.index(t[-2])
0
indication
Read / write tempo indication.
leaves

Return read-only tuple of leaves in spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[:2])
abjad> spanner.leaves
(Note(c', 8), Note(d', 8))

Changed in version 1.1.1: Now returns an (immutable) tuple instead of a (mutable) list.

offset

New in version 1.1.1.

Return read-only reference to spanner offset interface.

Spanner offset interface implements start and stop attributes.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[2:])
abjad> spanner
Spanner(e'8, f'8)
abjad> spanner.offset.start
Rational(1, 4)
abjad> spanner.offset.stop
Rational(1, 2)
pop()

Remove and return rightmost component in spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[:])
abjad> spanner
Spanner(c'8, d'8, e'8, f'8)
abjad> spanner.pop( )
f'8
abjad> spanner
Spanner(c'8, d'8, e'8)
pop_left()

Remove and return leftmost component in spanner.

abjad> voice = Voice(construct.scale(4))
abjad> spanner = Spanner(voice[:])
abjad> spanner
Spanner(c'8, d'8, e'8, f'8)
abjad> spanner.pop_left( )
c'8
abjad> spanner
Spanner(d'8, e'8, f'8)
proportional_notation_duration_effective

Read-only LilyPond proportionalNotationDuration. Raises UndefinedTempoError if reference tempo undefined. Raises UndefinedSpacingError if reference spacing undefined.

Todo

Write Tempo.proportional_notation_duration_effective( ) tests.

proportional_notation_duration_reference

Read / write LilyPond proportionalNotationDuration. Must be rational-valued duration.

Todo

Write Tempo.proportional_notation_duration_reference( ) tests.

reference
Read / write reference tempo indication. If set, scale durations at format-time.
scaling_factor
Reference tempo divided by indicated tempo.

Previous topic

Tempo

Next topic

Text

This Page