Source Code: Astronomia Meme and Funeral Dance | melodies the Arduino way

Introduction

This is a worldwide viral meme music is known as Astronomia Meme and Funeral Dance. The origin of these viral videos is Ghana, a country of Western Africa. The tradition is to celebrate death and the journey thereafter to another world.

Video Demonstration

Source Code

 1#include "pitches.h"
 2
 3#define SPEAKER_PIN 3
 4
 5int melody[] = {
 6  NOTE_AS4, NOTE_AS4, NOTE_AS4, NOTE_AS4,
 7  NOTE_AS4, NOTE_AS4, NOTE_AS4, NOTE_AS4,
 8  NOTE_AS4, NOTE_AS4, NOTE_AS4, NOTE_AS4,
 9  NOTE_AS4, NOTE_AS4, NOTE_AS4, NOTE_AS4,
10  NOTE_AS4, NOTE_AS4, NOTE_AS4, NOTE_AS4,
11  NOTE_D5, NOTE_D5, NOTE_D5, NOTE_D5,
12  NOTE_C5, NOTE_C5, NOTE_C5, NOTE_C5, 
13  NOTE_F5, NOTE_F5, NOTE_F5, NOTE_F5, 
14  NOTE_G5, NOTE_G5, NOTE_G5, NOTE_G5,
15  NOTE_G5, NOTE_G5, NOTE_G5, NOTE_G5, 
16  NOTE_G5, NOTE_G5, NOTE_G5, NOTE_G5, 
17  NOTE_C5, NOTE_AS4, NOTE_A4, NOTE_F4,
18  NOTE_G4, 0, NOTE_G4, NOTE_D5,
19  NOTE_C5, 0, NOTE_AS4, 0,
20  NOTE_A4, 0, NOTE_A4, NOTE_A4,
21  NOTE_C5, 0, NOTE_AS4, NOTE_A4, 
22  NOTE_G4,0, NOTE_G4, NOTE_AS5,
23  NOTE_A5, NOTE_AS5, NOTE_A5, NOTE_AS5,
24  NOTE_G4,0, NOTE_G4, NOTE_AS5,
25  NOTE_A5, NOTE_AS5, NOTE_A5, NOTE_AS5,
26  NOTE_G4, 0, NOTE_G4, NOTE_D5,
27  NOTE_C5, 0, NOTE_AS4, 0,
28  NOTE_A4, 0, NOTE_A4, NOTE_A4,
29  NOTE_C5, 0, NOTE_AS4, NOTE_A4, 
30  NOTE_G4,0, NOTE_G4, NOTE_AS5,
31  NOTE_A5, NOTE_AS5, NOTE_A5, NOTE_AS5,
32  NOTE_G4,0, NOTE_G4, NOTE_AS5,
33  NOTE_A5, NOTE_AS5, NOTE_A5, NOTE_AS5
34 };
35
36// note durations: 4 = quarter note, 8 = eighth note, etc.:
37int noteDurations[] = {
38  4,4,4,4,
39  4,4,4,4,
40  4,4,4,4,
41  4,4,4,4,
42  4,4,4,4,
43  4,4,4,4,
44  4,4,4,4,
45  4,4,4,4,
46  4,4,4,4,
47  4,4,4,4,
48  4,4,4,4,
49  4,4,4,4,
50  4,4,4,4,
51  4,4,4,4,
52  4,4,4,4,
53  4,4,4,4,
54  4,4,4,4,
55  4,4,4,4,
56  4,4,4,4,
57  4,4,4,4,
58  4,4,4,4,
59  4,4,4,4,
60  4,4,4,4,
61  4,4,4,4,
62  4,4,4,4,
63  4,4,4,4,
64  4,4,4,4,
65  4,4,4,4,
66  };
67
68void setup() {
69  for (int thisNote = 0; thisNote < 214; thisNote++) {
70
71    // Sound the note
72    int noteDuration = 750 / noteDurations[thisNote];
73    tone(SPEAKER_PIN, melody[thisNote], noteDuration);
74
75    // Delay for some time
76    int pauseBetweenNotes = noteDuration * 1.30;
77    delay(pauseBetweenNotes);
78
79    // Turn off the tone
80    noTone(SPEAKER_PIN);
81
82    // and repeat until all notes being played
83  }
84}
85
86void loop() {
87}

Include:
Copy the following and save it as pitches.h at the same folder of the project.

 1
 2/*************************************************
 3 * Public Constants
 4 *************************************************/
 5
 6#define NOTE_B0  31
 7#define NOTE_C1  33
 8#define NOTE_CS1 35
 9#define NOTE_D1  37
10#define NOTE_DS1 39
11#define NOTE_E1  41
12#define NOTE_F1  44
13#define NOTE_FS1 46
14#define NOTE_G1  49
15#define NOTE_GS1 52
16#define NOTE_A1  55
17#define NOTE_AS1 58
18#define NOTE_B1  62
19#define NOTE_C2  65
20#define NOTE_CS2 69
21#define NOTE_D2  73
22#define NOTE_DS2 78
23#define NOTE_E2  82
24#define NOTE_F2  87
25#define NOTE_FS2 93
26#define NOTE_G2  98
27#define NOTE_GS2 104
28#define NOTE_A2  110
29#define NOTE_AS2 117
30#define NOTE_B2  123
31#define NOTE_C3  131
32#define NOTE_CS3 139
33#define NOTE_D3  147
34#define NOTE_DS3 156
35#define NOTE_E3  165
36#define NOTE_F3  175
37#define NOTE_FS3 185
38#define NOTE_G3  196
39#define NOTE_GS3 208
40#define NOTE_A3  220
41#define NOTE_AS3 233
42#define NOTE_B3  247
43#define NOTE_C4  262
44#define NOTE_CS4 277
45#define NOTE_D4  294
46#define NOTE_DS4 311
47#define NOTE_E4  330
48#define NOTE_F4  349
49#define NOTE_FS4 370
50#define NOTE_G4  392
51#define NOTE_GS4 415
52#define NOTE_A4  440
53#define NOTE_AS4 466
54#define NOTE_B4  494
55#define NOTE_C5  523
56#define NOTE_CS5 554
57#define NOTE_D5  587
58#define NOTE_DS5 622
59#define NOTE_E5  659
60#define NOTE_F5  698
61#define NOTE_FS5 740
62#define NOTE_G5  784
63#define NOTE_GS5 831
64#define NOTE_A5  880
65#define NOTE_AS5 932
66#define NOTE_B5  988
67#define NOTE_C6  1047
68#define NOTE_CS6 1109
69#define NOTE_D6  1175
70#define NOTE_DS6 1245
71#define NOTE_E6  1319
72#define NOTE_F6  1397
73#define NOTE_FS6 1480
74#define NOTE_G6  1568
75#define NOTE_GS6 1661
76#define NOTE_A6  1760
77#define NOTE_AS6 1865
78#define NOTE_B6  1976
79#define NOTE_C7  2093
80#define NOTE_CS7 2217
81#define NOTE_D7  2349
82#define NOTE_DS7 2489
83#define NOTE_E7  2637
84#define NOTE_F7  2794
85#define NOTE_FS7 2960
86#define NOTE_G7  3136
87#define NOTE_GS7 3322
88#define NOTE_A7  3520
89#define NOTE_AS7 3729
90#define NOTE_B7  3951
91#define NOTE_C8  4186
92#define NOTE_CS8 4435
93#define NOTE_D8  4699
94#define NOTE_DS8 4978

Call To Action

That’s all folks. Thank you.

Happy tinkering.



Posts in this series



No comments yet!

GitHub-flavored Markdown & a sane subset of HTML is supported.