'Cuckoo Clock'

Hey guys,
First of all, I just wanted to say that this is my first post in a forum ever (so if I do something wrong, tell me instead of getting angry :~ :~ btw i just turned 14 a week ago). Also, I'm a beginner with Arduino, and am actually using a product called the SparkFun RedBoard to create my own project. I wanted to make a 'clock' that would light up an individual LED each hour and play the 'Imperial March' (Star Wars nerd right here :P). I didn't even need it to connect to a servo or anything, I just wanted that simple thing. So, I wrote the code for the LEDs that would light up one after another every hour until they would turn off in reverse order. I've attached it.
It worked just fine with my board.
After that, since I can't write code for a song. much less the Imperial March, I decided to get one from the internet. I found it in the following site: Marcha imperial para arduino · GitHub (I've also attached it)
It had some details about using an LED to visualize the song but I just deleted those parts out (I did my best, but there might still be some left). Again, it worked perfectly (to the point that I showed it off to all my friends and sat listening to it for 10 minutes). The problem is, when I try and combine both codes, it doesn't work. One LED lights up, the song plays, and then nothing else happens. Code is also attached.
Any and all help would be appreciated.
Regards from Brazil,
XenonCop

Circuit_04_Mod_for_Clock.ino (577 Bytes)

Imperial_March.ino (3.89 KB)

Integrated_Clock_and_Music_Code.ino (4.36 KB)

You do not need the while(true){} infinite loop

 int speakerPin = 9;
//speaker connected to one of the PWM ports
int ledPins[] = {2,3,4,5,6,7,8,1,10,11,12,13};
 
#define c 261
#define d 294
#define e 329
#define f 349
#define g 391
#define gS 415
#define a 440
#define aS 455
#define b 466
#define cH 523
#define cSH 554
#define dH 587
#define dSH 622
#define eH 659
#define fH 698
#define fSH 740
#define gH 784
#define gSH 830
#define aH 880
//frequencies for the tones we're going to use

 void setup()
{
  int index;
  
  for(index = 0; index <= 11; index++)
  {
    pinMode(ledPins[index],OUTPUT);
  }
  pinMode(speakerPin, OUTPUT); 	
  //sets the speakerPin to be an output
}

void loop() 	// run over and over again
{
  oneAfterAnotherLoop();
} 	 

void oneAfterAnotherLoop()
{
  int index;
  int delayTime = 30; 
  
  for(index = 0; index <= 11; index++)
  {
    digitalWrite(ledPins[index], HIGH);
    delay(delayTime); 
  march();
  // while(true){}//remove for infinite loop    
  }                                  

  
  for(index = 11; index >= 0; index--)
  {
    digitalWrite(ledPins[index], LOW);
    delay(delayTime);
     march();
  // while(true){}//remove for infinite loop 
  }               
}

void beep (unsigned char speakerPin, int frequencyInHertz, long timeInMilliseconds)
{ 

    //use led to visualize the notes being played
    
    int x; 	 
    long delayAmount = (long)(1000000/frequencyInHertz);
    long loopTime = (long)((timeInMilliseconds*1000)/(delayAmount*2));
    for (x=0;x<loopTime;x++) 	 
    { 	 
        digitalWrite(speakerPin,HIGH);
        delayMicroseconds(delayAmount);
        digitalWrite(speakerPin,LOW);
        delayMicroseconds(delayAmount);
    } 	 
    

    
    delay(20);
    //a little delay to make all notes sound separate
} 	 
  	 
void march()
{ 	 
    //for the sheet music see:
    //http://www.musicnotes.com/sheetmusic/mtd.asp?ppn=MN0016254
    //this is just a translation of said sheet music to frequencies / time in ms
    //used 500 ms for a quart note
    
    beep(speakerPin, a, 500); 
    beep(speakerPin, a, 500);     
    beep(speakerPin, a, 500); 
    beep(speakerPin, f, 350); 
    beep(speakerPin, cH, 150);
    
    beep(speakerPin, a, 500);
    beep(speakerPin, f, 350);
    beep(speakerPin, cH, 150);
    beep(speakerPin, a, 1000);
    //first bit
    
    beep(speakerPin, eH, 500);
    beep(speakerPin, eH, 500);
    beep(speakerPin, eH, 500);    
    beep(speakerPin, fH, 350); 
    beep(speakerPin, cH, 150);
    
    beep(speakerPin, gS, 500);
    beep(speakerPin, f, 350);
    beep(speakerPin, cH, 150);
    beep(speakerPin, a, 1000);
    //second bit...
    
    beep(speakerPin, aH, 500);
    beep(speakerPin, a, 350); 
    beep(speakerPin, a, 150);
    beep(speakerPin, aH, 500);
    beep(speakerPin, gSH, 250); 
    beep(speakerPin, gH, 250);
    
    beep(speakerPin, fSH, 125);
    beep(speakerPin, fH, 125);    
    beep(speakerPin, fSH, 250);
    delay(250);
    beep(speakerPin, aS, 250);    
    beep(speakerPin, dSH, 500);  
    beep(speakerPin, dH, 250);  
    beep(speakerPin, cSH, 250);  
    //start of the interesting bit
    
    beep(speakerPin, cH, 125);  
    beep(speakerPin, b, 125);  
    beep(speakerPin, cH, 250);      
    delay(250);
    beep(speakerPin, f, 125);  
    beep(speakerPin, gS, 500);  
    beep(speakerPin, f, 375);  
    beep(speakerPin, a, 125); 
    
    beep(speakerPin, cH, 500); 
    beep(speakerPin, a, 375);  
    beep(speakerPin, cH, 125); 
    beep(speakerPin, eH, 1000); 
    //more interesting stuff (this doesn't quite get it right somehow)
    
    beep(speakerPin, aH, 500);
    beep(speakerPin, a, 350); 
    beep(speakerPin, a, 150);
    beep(speakerPin, aH, 500);
    beep(speakerPin, gSH, 250); 
    beep(speakerPin, gH, 250);
    
    beep(speakerPin, fSH, 125);
    beep(speakerPin, fH, 125);    
    beep(speakerPin, fSH, 250);
    delay(250);
    beep(speakerPin, aS, 250);    
    beep(speakerPin, dSH, 500);  
    beep(speakerPin, dH, 250);  
    beep(speakerPin, cSH, 250);  
    //repeat... repeat
    
    beep(speakerPin, cH, 125);  
    beep(speakerPin, b, 125);  
    beep(speakerPin, cH, 250);      
    delay(250);
    beep(speakerPin, f, 250);  
    beep(speakerPin, gS, 500);  
    beep(speakerPin, f, 375);  
    beep(speakerPin, cH, 125); 
           
    beep(speakerPin, a, 500);            
    beep(speakerPin, f, 375);            
    beep(speakerPin, c, 125);            
    beep(speakerPin, a, 1000);       
    //and we're done \??/    
}

So it really has nothing to do with a Cuckoo Clock saying "Cuckoo" every hour.

Ah well ..........

...R