/
Chords.io
45 lines (37 loc) · 1.02 KB
/
Chords.io
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Chord := Object clone do(
notes := method("(undefined)")
root := nil
asString := method( root inSharps )
setRoot := method(newRoot,
root = Notes getSlot(newRoot asString)
self
)
maj := method( MajorChord clone setRoot(root) )
min := method( MinorChord clone setRoot(root) )
dom := method( Dominant7thChord clone setRoot(root) )
)
MajorChord := Chord clone do(
notes = method( list(root, root third, root fifth) )
)
MajorChords := List clone do(
Notes foreach(note,
append(
setSlot(note inFlats, MajorChord clone setRoot(note))
)
)
)
MinorChord := Chord clone do(
asString := method( super(asString) .. "min" )
notes = method( list(root, root minorThird, root fifth) )
)
Dominant7thChord := MajorChord clone do(
asString := method( super(asString) .. "dom" )
notes = method( super(notes) append(root seventh flat) )
)
Chords := List clone do (
MajorChords foreach(chord,
setSlot(chord root inFlats, chord)
setSlot(chord root inSharps, chord) // might overwrite the flats version
append(chord)
)
)