pyabc2.Key¶
- class pyabc2.Key(name=None, *, tonic=None, mode=None)¶
Key, including mode.
Pass either name (key spec with tonic and mode combined, used in ABC notation) or tonic and mode.
- Parameters:
Examples
>>> from pyabc2 import Key >>> Key('C') Key(tonic=C, mode='Major')
>>> Key('Ador') Key(tonic=A, mode='Dorian') >>> Key('Em') Key(tonic=E, mode='Minor')
>>> Key(tonic='Bb', mode='Locrian') Key(tonic=Bb, mode='Locrian')
- __init__(name=None, *, tonic=None, mode=None)¶
Methods
__init__([name, tonic, mode])parse_key(key)Parse a key spec string (e.g.,
D,Amin) and return the tonic and mode (3-char abbreviation).print_chromatic_scale_degrees(**kwargs)print_intervals(*[, fmt])print_scale()print_scale_chromatic_values()print_scale_degrees_wrt_major(**kwargs)relative(mode, *[, match_acc])Compute a relative key by specifying the target mode.
Attributes
accidentalsA dictionary of accidentals in the key signature, mapping natural note names to the accidental applied.
intervalsList of the intervals that compose the scale.
key_signatureList of accidentals that should be displayed in the key signature for the given key description.
modeFull mode name (e.g.,
Major).relative_majorrelative_minorscaleNotes (pitch classes) of the scale.
scale_chromatic_valuesInteger chromatic values that make up the scale, relative to the tonic.
scale_degrees_wrt_majorScale degrees of the mode's scale, with #/b as compared to the major scale with the same tonic.
tonicThe tonic of the key.