Class: Signature

Environment: Siren
Superclass: Object
Category: Music-PitchClasses
Instance variables: sharps flats

Notion of signature is related to the notion of "legal" scales, i.e.
scales having only sharps OR flats in their signature.
So method tonality here works only for legal scales.
It should possible to compute the tonality for arbitrary scales though,
but I am not sure how

printing

printOn: s

storeOn: s

testing

flatsInRightOrder

isEmpty

isLegal

sharpsInRightOrder

tonality

tonality

access

alterate: aNaturalNote

flats

initialize

nbFlats: n

nbSharps: n

reOrderSharpsAndFlats
attempts to reorder flats and sharps according to the natural order as found in
PitchClass

sharps

sharps: s flats: f
attempts to reorder flats and sharps according to the natural order as found in
PitchClass

MetaClass: Signature class

examples

example

example2
Signature new tonality -> C MajorScale
(Signature new nbSharps: 4) tonality -> E MajorScale
(Signature new nbFlats: 3) tonality -> Eb MajorScale

example3
Signature fromTonality: N D majorScale
Signature fromTonality: N E flat majorScale

example4
Signatures may be created for illegal scales. However, method
tonality yields an error for these scales:
Signature fromTonality: N D minorScale -> 1 sharps; 1 flats
Signature sharps: (Array with: N F sharp) flats: (Array with: (N E flat)) -> 1 sharps; 1 flats
(Signature fromTonality: N D minorScale) tonality -> error

creation

choseSignature
Signature choseSignature

fromTonality: aScale
Signature fromTonality: N E flat majorScale

new

sharps: s flats: f