COSA
An Object-Oriented Platform for Arduino Programming
Note.hh
Go to the documentation of this file.
1 
21 #ifndef COSA_NOTE_HH
22 #define COSA_NOTE_HH
23 
24 #include <math.h>
25 
38 class Note {
39 public:
40  enum {
41  END = 0,
42  PAUSE = 1,
43 
44  C0 = 16,
45  Cis0 = 17,
46  Des0 = 17,
47  D0 = 18,
48  Dis0 = 19,
49  Es0 = 19,
50  E0 = 21,
51  F0 = 22,
52  Fis0 = 23,
53  Ges0 = 23,
54  G0 = 25,
55  Gis0 = 26,
56  As0 = 26,
57  A0 = 28,
58  Ais0 = 29,
59  Bes0 = 29,
60  B0 = 31,
61 
62  C1 = 33,
63  Cis1 = 35,
64  Des1 = 35,
65  D1 = 37,
66  Dis1 = 39,
67  Es1 = 39,
68  E1 = 41,
69  F1 = 44,
70  Fis1 = 46,
71  Ges1 = 46,
72  G1 = 49,
73  Gis1 = 52,
74  As1 = 52,
75  A1 = 55,
76  Ais1 = 58,
77  Bes1 = 58,
78  B1 = 62,
79 
80  C2 = 65,
81  Cis2 = 69,
82  Des2 = 69,
83  D2 = 73,
84  Dis2 = 78,
85  Es2 = 78,
86  E2 = 82,
87  F2 = 87,
88  Fis2 = 93,
89  Ges2 = 93,
90  G2 = 98,
91  Gis2 = 104,
92  As2 = 104,
93  A2 = 110,
94  Ais2 = 117,
95  Bes2 = 117,
96  B2 = 123,
97 
98  C3 = 131,
99  Cis3 = 139,
100  Des3 = 139,
101  D3 = 147,
102  Dis3 = 156,
103  Es3 = 156,
104  E3 = 165,
105  F3 = 175,
106  Fis3 = 185,
107  Ges3 = 185,
108  G3 = 196,
109  Gis3 = 208,
110  As3 = 208,
111  A3 = 220,
112  Ais3 = 233,
113  Bes3 = 233,
114  B3 = 247,
115 
116  C4 = 262,
117  Cis4 = 277,
118  Des4 = 277,
119  D4 = 294,
120  Dis4 = 311,
121  Es4 = 311,
122  E4 = 330,
123  F4 = 349,
124  Fis4 = 370,
125  Ges4 = 370,
126  G4 = 392,
127  Gis4 = 415,
128  As4 = 415,
129  A4 = 440,
130  Ais4 = 466,
131  Bes4 = 466,
132  B4 = 494,
133 
134  C5 = 523,
135  Cis5 = 554,
136  Des5 = 554,
137  D5 = 587,
138  Dis5 = 622,
139  Es5 = 622,
140  E5 = 659,
141  F5 = 698,
142  Fis5 = 740,
143  Ges5 = 740,
144  G5 = 784,
145  Gis5 = 831,
146  As5 = 831,
147  A5 = 880,
148  Ais5 = 932,
149  Bes5 = 932,
150  B5 = 988,
151 
152  C6 = 1047,
153  Cis6 = 1109,
154  Des6 = 1109,
155  D6 = 1175,
156  Dis6 = 1245,
157  Es6 = 1245,
158  E6 = 1319,
159  F6 = 1397,
160  Fis6 = 1480,
161  Ges6 = 1480,
162  G6 = 1568,
163  Gis6 = 1661,
164  As6 = 1661,
165  A6 = 1760,
166  Ais6 = 1865,
167  Bes6 = 1865,
168  B6 = 1976,
169 
170  C7 = 2093,
171  Cis7 = 2217,
172  Des7 = 2217,
173  D7 = 2349,
174  Dis7 = 2489,
175  Es7 = 2489,
176  E7 = 2637,
177  F7 = 2794,
178  Fis7 = 2960,
179  Ges7 = 2960,
180  G7 = 3136,
181  Gis7 = 3322,
182  As7 = 3322,
183  A7 = 3520,
184  Ais7 = 3729,
185  Bes7 = 3729,
186  B7 = 3951,
187 
188  C8 = 4186,
189  Cis8 = 4435,
190  Des8 = 4435,
191  D8 = 4699,
192  Dis8 = 4978,
193  Es8 = 4978,
194  E8 = 5274,
195  F8 = 5588,
196  Fis8 = 5920,
197  Ges8 = 5920,
198  G8 = 6272,
199  Gis8 = 6645,
200  As8 = 6645,
201  A8 = 7040,
202  Ais8 = 7459,
203  Bes8 = 7459,
204  B8 = 7902
205  };
206 
212  static uint16_t MIDI(uint8_t n)
213  {
214  return (round(440.0 * (pow(2.0, (n - 69.0) / 12))));
215  }
216 };
217 #endif
218 
Definition: Note.hh:96
Definition: Note.hh:90
Definition: Note.hh:78
Definition: Note.hh:44
Definition: Note.hh:38
Definition: Note.hh:60
Definition: Note.hh:54
Definition: Note.hh:87
Definition: Note.hh:98
Definition: Note.hh:57
Definition: Note.hh:62
Definition: Note.hh:75
Definition: Note.hh:83
Definition: Note.hh:80
Definition: Note.hh:50
static uint16_t MIDI(uint8_t n)
Definition: Note.hh:212
Definition: Note.hh:72
Definition: Note.hh:69
Definition: Note.hh:65
Definition: Note.hh:47
Definition: Note.hh:93
Definition: Note.hh:68
Definition: Note.hh:86
Definition: Note.hh:51