예제 #1
0
def make_desordre_cell(pitches):
    '''The function constructs and returns a *Désordre cell*.
    `pitches` is a list of numbers or, more generally, pitch tokens.
    '''

    notes = [scoretools.Note(pitch, (1, 8)) for pitch in pitches]
    beam = spannertools.Beam()
    attach(beam, notes)
    slur = spannertools.Slur()
    attach(slur, notes)
    clef = indicatortools.Dynamic('f')
    attach(clef, notes[0])
    dynamic = indicatortools.Dynamic('p')
    attach(dynamic, notes[1])

    # make the lower voice
    lower_voice = scoretools.Voice(notes)
    lower_voice.name = 'RH Lower Voice'
    command = indicatortools.LilyPondCommand('voiceTwo')
    attach(command, lower_voice)
    n = int(math.ceil(len(pitches) / 2.))
    chord = scoretools.Chord([pitches[0], pitches[0] + 12], (n, 8))
    articulation = indicatortools.Articulation('>')
    attach(articulation, chord)

    # make the upper voice
    upper_voice = scoretools.Voice([chord])
    upper_voice.name = 'RH Upper Voice'
    command = indicatortools.LilyPondCommand('voiceOne')
    attach(command, upper_voice)

    # combine them together
    container = scoretools.Container([lower_voice, upper_voice])
    container.is_simultaneous = True

    # make all 1/8 beats breakable
    leaves = select(lower_voice).by_leaf()
    for leaf in leaves[:-1]:
        bar_line = indicatortools.BarLine('')
        attach(bar_line, leaf)

    return container
예제 #2
0
    def make_spanner_score_06(self):
        r'''Make 200-note voice with slur spanner on every 100 notes.

        ::

            2.12 (r9724) initialization:        249,339 function calls

            2.12 (r9703) LilyPond format:       121,497 function calls
            2.12 (r9724) LilyPond format:       106,718 function calls

        '''
        from abjad.tools import scoretools
        from abjad.tools import sequencetools
        from abjad.tools import spannertools
        from abjad.tools import topleveltools
        voice = scoretools.Voice(200 * scoretools.Note("c'16"))
        for part in sequencetools.partition_sequence_by_counts(
                voice[:],
            [100],
                cyclic=True,
        ):
            slur = spannertools.Slur()
            topleveltools.attach(slur, part)
        return voice
예제 #3
0
             .by_leaf()
             .by_run(scoretools.Note)
             .by_counts(
                 [3, 3, 4],
                 cyclic=True,
                 overhang=True,
                 fuse_overhang=True,
                 )
             [0],
         ),
     dynamic_expressions=consort.DynamicExpression(
         start_dynamic_tokens='p mp',
         only_first=True,
         ),
     slur=consort.AttachmentExpression(
         attachments=spannertools.Slur(),
         selector=selectortools.Selector()
             .by_leaf()
             .by_run(scoretools.Note)
             .by_counts(
                 [3, 3, 4],
                 cyclic=True,
                 overhang=True,
                 fuse_overhang=True,
                 )
         ),
     ),
 pitch_handler=consort.AbsolutePitchHandler(
     deviations=[0, 2, 0, 3, 0, 3, 0, 2, 0, 5, 0, 3, 0, 5],
     pitch_specifier="d' f' df'",
     pitch_application_rate='phrase',