so this little tune is a little happycode that I used at 4 o’clock in the morning sewing a skirt that is due at 9am earlier this week at a friends house. Instead of complaining about why we are still awake sewing, I decided to use this tune as a positive response whenever we need a little boost before breaking down and refusing to finish our garment (just because coffee no longer suffice to the overdosed fashion student).

Sound link –>

Here is my code though….

#include “pitches.h”
int melody[] = {

int noteDurations[]={
2,4,4, 4,2,2, 2,4,4, 4,2,4};

void setup(){
// iterate over the notes of the melody:
for (int thisNote = 0; thisNote < 13; thisNote++) { //LOOP (if the note is 0, play the first note. thisNote<13 means dont exceed the 12th note

// to calculate the note duration, take one second
// divided by the note type.
//e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
int noteDuration = 1000/noteDurations[thisNote];
tone(8, melody[thisNote],noteDuration); // (pin no, melody array, noteDuration)

// the note’s duration + 30% seems to work well:
int pauseBetweenNotes = noteDuration * 1.30; //
// stop the tone playing:

void loop() {
// no need to repeat the melody.

Leave a Reply

Your email address will not be published.