Skip to content

Commit d6b4f3d

Browse files
committed
Bela Bartok - Konope, konope
1 parent ee8d302 commit d6b4f3d

File tree

2 files changed

+173
-0
lines changed

2 files changed

+173
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*************************************************
2+
* Public Constants
3+
*************************************************/
4+
5+
#define NOTE_B0 31
6+
#define NOTE_C1 33
7+
#define NOTE_CS1 35
8+
#define NOTE_D1 37
9+
#define NOTE_DS1 39
10+
#define NOTE_E1 41
11+
#define NOTE_F1 44
12+
#define NOTE_FS1 46
13+
#define NOTE_G1 49
14+
#define NOTE_GS1 52
15+
#define NOTE_A1 55
16+
#define NOTE_AS1 58
17+
#define NOTE_B1 62
18+
#define NOTE_C2 65
19+
#define NOTE_CS2 69
20+
#define NOTE_D2 73
21+
#define NOTE_DS2 78
22+
#define NOTE_E2 82
23+
#define NOTE_F2 87
24+
#define NOTE_FS2 93
25+
#define NOTE_G2 98
26+
#define NOTE_GS2 104
27+
#define NOTE_A2 110
28+
#define NOTE_AS2 117
29+
#define NOTE_B2 123
30+
#define NOTE_C3 131
31+
#define NOTE_CS3 139
32+
#define NOTE_D3 147
33+
#define NOTE_DS3 156
34+
#define NOTE_E3 165
35+
#define NOTE_F3 175
36+
#define NOTE_FS3 185
37+
#define NOTE_G3 196
38+
#define NOTE_GS3 208
39+
#define NOTE_A3 220
40+
#define NOTE_AS3 233
41+
#define NOTE_B3 247
42+
#define NOTE_C4 262
43+
#define NOTE_CS4 277
44+
#define NOTE_D4 294
45+
#define NOTE_DS4 311
46+
#define NOTE_E4 330
47+
#define NOTE_F4 349
48+
#define NOTE_FS4 370
49+
#define NOTE_G4 392
50+
#define NOTE_GS4 415
51+
#define NOTE_A4 440
52+
#define NOTE_AS4 466
53+
#define NOTE_B4 494
54+
#define NOTE_C5 523
55+
#define NOTE_CS5 554
56+
#define NOTE_D5 587
57+
#define NOTE_DS5 622
58+
#define NOTE_E5 659
59+
#define NOTE_F5 698
60+
#define NOTE_FS5 740
61+
#define NOTE_G5 784
62+
#define NOTE_GS5 831
63+
#define NOTE_A5 880
64+
#define NOTE_AS5 932
65+
#define NOTE_B5 988
66+
#define NOTE_C6 1047
67+
#define NOTE_CS6 1109
68+
#define NOTE_D6 1175
69+
#define NOTE_DS6 1245
70+
#define NOTE_E6 1319
71+
#define NOTE_F6 1397
72+
#define NOTE_FS6 1480
73+
#define NOTE_G6 1568
74+
#define NOTE_GS6 1661
75+
#define NOTE_A6 1760
76+
#define NOTE_AS6 1865
77+
#define NOTE_B6 1976
78+
#define NOTE_C7 2093
79+
#define NOTE_CS7 2217
80+
#define NOTE_D7 2349
81+
#define NOTE_DS7 2489
82+
#define NOTE_E7 2637
83+
#define NOTE_F7 2794
84+
#define NOTE_FS7 2960
85+
#define NOTE_G7 3136
86+
#define NOTE_GS7 3322
87+
#define NOTE_A7 3520
88+
#define NOTE_AS7 3729
89+
#define NOTE_B7 3951
90+
#define NOTE_C8 4186
91+
#define NOTE_CS8 4435
92+
#define NOTE_D8 4699
93+
#define NOTE_DS8 4978
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
Arduino Melody
3+
v. 1.0
4+
Copyright (C) 2020 Robert Ulbricht
5+
Copyright (C) 2011 Tom Igoe
6+
https://www.arduinoslovakia.eu
7+
8+
16t. Konope, konope
9+
Béla Bartók - Slovenské ľudové piesne
10+
Zuzana Spišiaková, Poniky, 1916
11+
https://musescore.com/user/30544023/scores/6411435
12+
13+
Plays a melody. 8 ohm speaker and 1k resistor on digital pin 8.
14+
15+
IDE: 1.8.12 or higher
16+
Board: Arduino
17+
18+
This program is free software: you can redistribute it and/or modify
19+
it under the terms of the GNU General Public License as published by
20+
the Free Software Foundation, either version 3 of the License, or
21+
(at your option) any later version.
22+
23+
This program is distributed in the hope that it will be useful,
24+
but WITHOUT ANY WARRANTY; without even the implied warranty of
25+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26+
GNU General Public License for more details.
27+
28+
You should have received a copy of the GNU General Public License
29+
along with this program. If not, see <http://www.gnu.org/licenses/>.
30+
*/
31+
32+
#include "pitches.h"
33+
34+
// notes in the melody
35+
int melody[] = {
36+
NOTE_G5, NOTE_F5, NOTE_E5, NOTE_G5,
37+
NOTE_C5, NOTE_G4,
38+
NOTE_G5, NOTE_F5, NOTE_E5, NOTE_G5,
39+
NOTE_C5, NOTE_G4,
40+
NOTE_G4, NOTE_C5,
41+
NOTE_D5, NOTE_E5, NOTE_F5, NOTE_B4,
42+
NOTE_F4, NOTE_A4,
43+
NOTE_C5, NOTE_D5,
44+
NOTE_G4,
45+
NOTE_G4, 0
46+
};
47+
48+
// note durations: 4 = quarter note, 8 = eighth note, etc.:
49+
int noteDurations[] = {
50+
8, 8, 8, 8,
51+
4, 4,
52+
8, 8, 8, 8,
53+
4, 4,
54+
4, 4,
55+
8, 8, 8, 8,
56+
4, 4,
57+
4, 4,
58+
2,
59+
4, 4
60+
};
61+
62+
int notesLength = sizeof(melody)/sizeof(int);
63+
64+
// beats per minute
65+
int bpm = 85;
66+
// duration of a beat in ms
67+
float beatDuration = 60.0 / bpm * 1000;
68+
69+
void setup() {
70+
}
71+
72+
void loop() {
73+
for (int thisNote = 0; thisNote < notesLength; thisNote++) {
74+
75+
float noteDuration = beatDuration * (4.0 / noteDurations[thisNote]);
76+
tone(8, melody[thisNote], noteDuration * 0.85);
77+
delay(noteDuration);
78+
}
79+
delay(500);
80+
}

0 commit comments

Comments
 (0)