Environment: Siren
automatic access
root: aValue
rootPitchClass
structure
structure: aValue
printing
produces a printable name (without the sharps before symbols)
notesString
printOn: s
quotedPrintOn: s
as printOn but without the brackets [] and with quotes
storeOn: s
returns a String representation of the receiver from which the receiver
can be reconstructed
structureString
note testing
The previous version couldnt deal with situations like
(FPChord newFromString: 'C 7 aug9') possibleTonalitiesInScaleClass: MajorScale
chordNotesAmong: list
select among given notes those that are chord notes
containsNote: n
nextIn: aCS
nonChordNotesAmong: list
select among given notes those that are chord notes
notes: aListOfNotes contains: anArrayOfIntervals
creation
format the structure. Assumes root is not nil
fromNotes: l
assumes the first note is the root
fromNotes: aList root: r
l isa list of pitch-classes.
This method computes the correct (and canonical) name for the chord
fromString: l
l is a list whose first element is a note and the rest a structure, in our
standardized chord syntax
structureFromNotes: aList root: r
l isa list of pitch-classes.
This method computes the correct (and canonical) name for the chord
notes computation
computes the list of notes from the structure. The job is the opposite
of what is written is method fromListOfNotes.
Assumes root is not nil.
| c |
c := FPChord newFromString: 'A halfDim7'.
c computeAllNotes.
c notes
computeDiminished
computeEleventh
computeFifth
computeNinth
computeRoot
computeSeventh
computeSixth
computeThird
computeThirteenth
notes
notesWithinOctave
accordingly, return the notes as in the case of a four note chord
with no higher dissonances
compute possible tonalities
analyseIn: aScale
en majeure, mineure harm et min mel
computePossibleTonalities
self allInstancesDo: [:x| x computePossibleTonalities]
matchWith: c
((Chord new fromString: 'D min 7') computeAllNotes) format
matchAvec: ((N re majorScale genereAccordsPoly: 4) at: 3).
possibleTonalitiesInScaleClass: s
possible tonalities in scale class s.
(PitchClassChord newFromString: 'C ') possibleTonalitiesInScaleClass: MajorScale AnalysisList ({I de C MajorScale} {IV de G MajorScale} {V de F MajorScale} )
There is a problem here, related to invalid scales. If you ask for
instance the possible tonalities of 'C# min', it will try to say that V of G# major is a
possible tonality. But the creation of G# major raises an error since it
is an invalid scale. For the moment I leave it as is because I would
like to have a model of reasoning in an object-oriented setting first
standardPossibleTonalities
possible tonalities in scale class major, minorMel and minorHarm
(Chord new fromString: 'C min') standardPossibleTonalities
ListeDAnalyses ({II de Sib MajorScale} {III de Lab MajorScale} {VI de
Mib MajorScale} {I de Do HarmonicMinorScale} {IV de Sol
HarmonicMinorScale} {I de Do MelodicMinorScale} {II de Sib
MelodicMinorScale} )
tonalitesCommunesAvec: unAccord
(FPChord newFromString: 'C min') tonalitesCommunesAvec: (FPChord
newFromString: 'D b ')
tonalitesCommunesAvec: unAccord et: autreAccord
(FPChord newFromString: 'C min') tonalitesCommunesAvec: (FPChord
newFromString: 'D b ')
transposing
transposeOf: interval
FP
accessing
possibleTonalities
initializations
initialize
resetNotes
reset notes to an empty collection when an important change occurred
accessing by intervals
theFourth
theOctave
theSeventh
theThird
theTonic
testing ok
hasA: anInterval
(FPChord newFromString: 'C min 7') hasA: #majorThird
hasADiminishedFifth
hasADiminishedSeventh
hasAMajorSeventh
hasAMinorSeventh
hasAnAugmentedFifth
hasNoFifth
hasNoSeventh
isAlterate
isDiminished
isDominant
isHalfDiminished
isMajor
isMinor
isSuspended
structureHasEitherOf: aList
structureHasNeitherOf: aList
mutations
asPlayableObject
defaultOctave
fondamental
inTessitura: qt
lapse: l
octave: n
startBeat: s duration: d
a default octave is used
startTime: s duration: d
tessitura
other computations
remark: not that this method answers the interval between
the root *pitch classes*!!
private-pact
answer the most plausible tonality when the chor is isolated.
Later, I will rewrite it to bypass possibleTonalities for sake of efficience
MetaClass: PitchClassChord class
creation
newFromNotes: l
computes the name from the list of notes, according to our syntax
newFromNotesNames: aStringOfNoteNames
computes the name from the list of notes, according to our syntax
PitchClassChord newFromNotesNames: 'A C# E G' [La 7 ]
newFromString: l
computes the list of notes fom the name acording to our syntax
root: r structure: s
editing
examples
self allChordsFromListOfNotes: (Array with: N do with: N mi with: N sol)
#(Do Mi #min #no5 #no11 #no9 #no7 #dim13 Sol #sus4 #no5 #sixth )
self allChordsFromListOfNotes: (Array with: N do with: N mi with: N sol with: N si)
commonTonalities
(PitchClassChord new fromString: 'C maj7')
possibleTonalities AnalysisList ({I of C MajorScale} {IV of G MajorScale} {VI of E HarmonicMinorScale} )
(PitchClassChord new fromString: 'F maj7')
possibleTonalities AnalysisList ({I of F MajorScale} {IV of C MajorScale} {VI of A HarmonicMinorScale} )
(PitchClassChord new fromString: 'E min 7')
possibleTonalities AnalysisList ({II of D MajorScale} {III of C MajorScale} {VI of G MajorScale} {IV of B HarmonicMinorScale} {II of D MelodicMinorScale} )
----
(PitchClassChord new fromString: 'C maj7')
tonalitesCommunesAvec: (PitchClassChord new fromString: 'F maj7')
et: (PitchClassChord new fromString: 'E min 7') Set (C MajorScale )
examples
(PitchClassChord new fromString: 'Re maj7') notes OrderedCollection (Re Fa# La Do# )
(PitchClassChord new fromString: 'Re# maj7') notes OrderedCollection (Re# Fa## La# Do## )
(PitchClassChord new fromString: 'C') notes OrderedCollection (Do Mi Sol )
(PitchClassChord new fromString: 'D min 7 dim5') notes OrderedCollection (Re Fa Lab Do )
(PitchClassChord new fromString: 'C aug9') notes OrderedCollection (Do Mi Sol Sib Re# )
(PitchClassChord new fromString: 'C aug9 dim5') notes OrderedCollection (Do Mi Solb Sib Re# )
(PitchClassChord new fromString: 'C 13') notes OrderedCollection (Do Mi Sol Sib Re Fa La )
(PitchClassChord new fromString: 'C 13 aug9') notes OrderedCollection (Do Mi Sol Sib Re# Fa La )
(PitchClassChord new fromString: 'C 13 aug9 no7') notes OrderedCollection (Do Mi Sol Re# Fa La )
(PitchClassChord new fromString: 'C halfDim7') notes OrderedCollection (Do Mib Solb Sib )
'F min 7' asChord notes > OrderedCollection (F Ab C Eb )
'F min7' asChord notes > OrderedCollection (F A C )
'F m 7' asChord notes > OrderedCollection (F A C Eb )
'Fm 7' asChord notes > error
'F maj 7' asChord notes > error
'F m7' asChord notes > OrderedCollection (F A C )
'F maj 7' asChord notes > OrderedCollection (F A C Eb )
'F maj7' asChord notes > OrderedCollection (F A C E )
'F halfDim7' asChord notes > OrderedCollection (F Ab Cb Eb )
'F min dim5 7' asChord notes OrderedCollection (F Ab Cb Eb )
'F min b5 7' asChord notes OrderedCollection (F Ab Cb Eb )
'F dim7' asChord notes OrderedCollection (F A C Ebb )
PitchClassChord new fromNotes: (Array with: N do with: N mi with: N sol) Do
PitchClassChord new fromNotes: (Array with: N do with: N mi with: N sol sharp) Do #aug5
PitchClassChord new fromNotes: (Array with: N do with: N fa with: N sol ) Do #sus4
PitchClassChord new fromNotes: (Array with: N do with: N mi with: N sol with: N la) Do #sixth
PitchClassChord new fromNotes: (Array with: N do with: N mi with: N la) Do #no5 #sixth
PitchClassChord new fromNotes: (Array with: N do with: N la) Do #no3 #no5 #sixth
PitchClassChord new fromNotes: (Array with: N do with: N mi with: N sol sharp with: N si) Do #aug5 #maj7
PitchClassChord new fromNotes: (Array with: N do with: N mi with: N sol flat with: N si flat) Do #dim5 7
PitchClassChord new fromNotes: (Array with: N do with: N mi flat with: N sol flat with: N si flat) Do #halfDim7
PitchClassChord new fromNotes: (Array with: N do with: N mi flat with: N sol flat with: N si flat flat) Do #dim7
PitchClassChord new fromNotes: (Array with: N do with: N mi flat) Do #min #no5
PitchClassChord new fromNotes: (Array with: N do with: N mi with: N fa with: N fa sharp ) Do #no5 #no9 #no7 11 #aug11
PitchClassChord new fromNotes: (Array with: N do with: N sol flat with: N sol sharp) Do #no3 #dim5 #aug5
A chord of A. holdsworth
PitchClassChord new fromNotes: (Array with: N re sharp with: N fa sharp sharp with: N la with: N do sharp sharp) Re# #dim5 #maj7
(PitchClassChord new fromString: 'C min') standardPossibleTonalities OrderedCollection ({II de Sib MajorScale} {III de Lab MajorScale} {VI de Mib MajorScale} {I de Do HarmonicMinorScale} {IV de Sol HarmonicMinorScale} {I de Do MelodicMinorScale} {II de Sib MelodicMinorScale} )
(PitchClassChord new fromString: 'Do') possibleTonalities
ListeDAnalyses ({V de Fa HungarianMinor} {VI de Mi HungarianMinor} {I de Do MajorScale} {IV de Sol MajorScale} {V de Fa MajorScale} {I de Do DoubleHarmonic} {II de Si DoubleHarmonic} {IV de Sol MelodicMinorScale} {V de Fa MelodicMinorScale} {IV de Sol Oriental} {IV de Sol NeapolitanMajor} {V de Fa HarmonicMinorScale} {VI de Mi HarmonicMinorScale} {II de Si NeapolitanMinor} {VI de Mi NeapolitanMinor} )
(PitchClassChord new fromString: 'D min ') possibleTonalities
ListeDAnalyses ({I de Re HungarianMinor} {VII de Mib HungarianMinor} {II de Do MajorScale} {III de Sib MajorScale} {VI de Fa MajorScale} {III de Sib DoubleHarmonic} {IV de La DoubleHarmonic} {I de Re MelodicMinorScale} {II de Do MelodicMinorScale} {I de Re NeapolitanMajor} {I de Re HarmonicMinorScale} {IV de La HarmonicMinorScale} {I de Re NeapolitanMinor} {IV de La NeapolitanMinor} )
exampleShort
'C min 7 dim5' asChord.
('C min 7 dim5 9' asChordOct: 4) notes
OrderedCollection (C4 Eb4 Gb4 Bb4 D5 )
holdsworth
reallyAllChordsFromListOfNotes: aList
self reallyAllChordsFromListOfNotes: (Array with: N do with: N mi with: N sol)
OrderedCollection ([La #noRoot #min 7 ] [Si #noRoot #sus4 #no5 #no7 #dim9 #dim13 ] [Do ] [Re #noRoot #sus4 #no5 7 9 ] [Mi #min #no5 #no11 #no9 #no7 #dim13 ] [Fa #noRoot #no3 #maj7 9 ] [Sol #sus4 #no5 #sixth ] [La# #noRoot #no3 #dim5 ] [Do# #noRoot #min #dim5 ] [Re# #noRoot #no3 #no5 #dim9 ] [Fa# #noRoot #no3 #dim5 7 #dim9 ] [Sol# #noRoot #no3 #no5 #no11 #no9 #no7 #dim13 ] [Lab #noRoot #aug5 #maj7 ] [Sib #noRoot #no3 #no5 #no7 9 #aug11 #sixth ] [Reb #noRoot #no3 #no5 #maj7 #aug9 #aug11 ] [Mib #noRoot #no5 #sixth ] [Solb #noRoot #no3 #no5 #no9 #no7 #aug11 ] )