-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
123 lines (107 loc) · 2.32 KB
/
types.go
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package notes
// Pitch symbolises all available pitches in twelve-tone system
type Pitch int
// PitchOctave symbolises all available octaves for a single note
type PitchOctave int
// Note symbolises all available notes within all available octaves.
// IsInScale checks if the note is available in a scale
// generated for the neck
type Note struct {
Pitch Pitch
PitchOctave PitchOctave
IsInScale bool
}
// Fret symbolises the fret on a guitar
type Fret int
// String symbolises a collection of notes on each fret of a string
type String map[Fret]Note
// GuitarStrings symbolises all available guitar strings permutations
// For now, only 6, 7 and 8 strings are available
type GuitarStrings int
// GuitarFrets symbolises all available guitar frets permutations
type GuitarFrets int
// Neck symbolises a collection of notes on each fret on each string
// 0 fret symbolises to which note each string is tuned
type Neck struct {
FirstString String
SecondString String
ThirdString String
FourthString String
FifthString String
SixthString String
SeventhString String
EightString String
}
// Interval depict all available intervals within one octave
type Interval int
// Notes is a collection of all notes generated from root
type Notes []Note
// Scale symbolises any custom scale that will allow for
// propagating all available notes on the neck
type Scale struct {
// Name is the name of the scale
Name string
// Intervals describes how the scale is built within one octave
Intervals []Interval
// RootNote sets the scale starting point
RootNote Note
// Notes describes all available notes
// within one octave from the Root note
Notes Notes
}
const (
C Pitch = iota
Csharp
D
Dsharp
E
F
Fsharp
G
Gsharp
A
Asharp
B
)
const (
SixString GuitarStrings = iota + 6
SevenString
EightString
)
const (
TwentyOneFrets GuitarFrets = iota + 21
TwentyTwoFrets
_
TwentyFourFrets
_
_
TwentySevenFrets // Because Majesty II has 27, I want to be able to use them all...
)
const (
Root Interval = iota
MinorSecond
MajorSecond
MinorThird
MajorThird
Fourth
Tritone
Fifth
MinorSixth
MajorSixth
MinorSeventh
MajorSeventh
Octave
)
const (
MinusOneOctave PitchOctave = iota - 1
ZeroOctave
FirstOctave
SecondOctave
ThirdOctave
FourthOctave
FifthOctave
SixthOctave
SeventhOctave
EightOctave
NinthOctave
)