Unclear how to fix error:

Hi everyone!
I’m in a programming class and we have just started using arduino. I’m supposed to write a program that will play a melody when my board is hooked up to a speaker. I typed out all of my code and cannot seem to get it to compile. The error message :Arduino-3.ino:47: error: expected unqualified-id before ‘{’ token" pops up, and I have triple checked all of my { and } to make sure they have matches. Any ideas on what is wrong?

My code is attached, and I will also copy and paste it. Thanks!

int c = 3830; //261 Hz
int d = 3400; //294 Hz
int e = 3038; //329 Hz
int f = 2864; //349 Hz
int g = 2550; //329 Hz
int a = 2272; //440 Hz
int b = 2028; //493 Hz
int C = 1912; //523 Hz
int R = 0;

////Function Definition ///////
void playTone(const int tone_, const long beat, const long tempo, const int speakerPin)
{
long duration = beat*tempo;
const int rest_count = 100;
long elapsed_time = 0;
if (tone_ > 0)
{
while (elapsed_time < duration)
{
digitalWrite(speakerPin,HIGH);
delayMicroseconds(tone_ / 2);

digitalWrite(speakerPin, LOW);
delayMicroseconds(tone_ / 2);

elapsed_time += (tone_);
}
}
else
{
for (int j = 0; j < rest_count; j++)
{
delayMicroseconds(duration);
}
}
}
//////End of Function Definition /////////

int speakerOutPin = 13;
void setup()
{
pinMode(speakerOutPin, OUTPUT);
}

void loop();
{
long tempo= 10000: //Set overall tempo

playTone(C,16,tempo,speakerOutPin);
playTone(b,16,tempo,speakerOutPin);
playTone(g,16,tempo,speakerOutPin);
playTone(C,8 ,tempo,speakerOutPin);

playTone(b,8 ,tempo,speakerOutPin);
playTone(e,16,tempo,speakerOutPin);
playTone(R,32,tempo,speakerOutPin);
playTone(C,16,tempo,speakerOutPin);

playTone(c,16,tempo,speakerOutPin);
playTone(g,16,tempo,speakerOutPin);
playTone(a,8 ,tempo,speakerOutPin);
playTone(C,8 ,tempo,speakerOutPin);

delayMicroseconds(2000000);
}

Arduino-3.ino (1.42 KB)

You have a semicolon here that should not be there:

void loop();

You have a spurious ; after void loop()

You have a ";" after the void loop ()

It should not be there because it is a function not a command

Without looking at your code, I'd guess you have an excess semi colon after your void loop declaration. I really don't know where I get this idea from, it just came to me like a psychic vision.