Exemplo n.º 1
0
 def __init__(self, *args):
     if len(args) == 0:
         key_signature = indicatortools.KeySignature('c', 'major')
     elif len(args) == 1 and isinstance(args[0],
                                        indicatortools.KeySignature):
         key_signature = args[0]
     elif len(args) == 1 and isinstance(args[0], Scale):
         key_signature = args[0].key_signature
     elif len(args) == 2:
         key_signature = indicatortools.KeySignature(*args)
     else:
         raise TypeError
     npcs = [key_signature.tonic]
     for mdi in key_signature.mode.named_interval_segment[:-1]:
         named_pitch_class = npcs[-1] + mdi
         npcs.append(named_pitch_class)
     PitchClassSegment.__init__(
         self,
         items=npcs,
         item_class=pitchtools.NamedPitchClass,
     )
     self._key_signature = key_signature
Exemplo n.º 2
0
def make_desordre_score(pitches):
    '''Makes Désordre score.
    '''

    assert len(pitches) == 2
    staff_group = scoretools.StaffGroup()
    staff_group.context_name = 'PianoStaff'

    # build the music
    for hand in pitches:
        staff = abjad.demos.desordre.make_desordre_staff(hand)
        staff_group.append(staff)

    # set clef and key signature to left hand staff
    clef = indicatortools.Clef('bass')
    attach(clef, staff_group[1])
    key_signature = indicatortools.KeySignature('b', 'major')
    attach(key_signature, staff_group[1])

    # wrap the piano staff in a score
    score = scoretools.Score([staff_group])

    return score
Exemplo n.º 3
0
 def key(self, notename_pitch, number_list):
     r'''Handles LilyPond ``\key`` command.
     '''
     if number_list is None:
         number_list = 'major'
     return indicatortools.KeySignature(notename_pitch, number_list)