Let's say you are a hacker and you have to make a present. All you have is a shared song and some parts... that's all you need for this micro music box.
Circuits are easy: you have to connect the Buzzer to a Digital Pin and Ground and a Switch to another Digital Pin and Ground.
If you want to make the box portable, a small 3.3v lithium battery will do the trick.
For the case, you can just print two parts in your 3D printer or make a real box with a hidden switch.
What about the tunes?This box comes with Brahms Lullaby song tune but you can change it for any other tune by just editing notes and duration.
In fact you can find ready to be used arrays on the web for popular series and rock songs as well.
Several octaves frequencies are defined inside the code
#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_D1 37
#define NOTE_DS1 39
#define NOTE_E1 41
#define NOTE_F1 44
#define NOTE_FS1 46
#define NOTE_G1 49
#define NOTE_GS1 52
#define NOTE_A1 55
#define NOTE_AS1 58
#define NOTE_B1 62
#define NOTE_C2 65
#define NOTE_CS2 69
Notes and duration are stored inside the following array
int melody[] = {NOTE_G4, 4, NOTE_G4, 4,...}
Comments