Object not declared in scope

Hi, Apologies in advance for the length of this post.
I am a relative newbie to coding. I did electronics as a hobby years ago and wanted to get back into it again.
I'm building a RGB LED clock with an outer ring for the minutes and an inner ring for the hours.
I want to add a buzzer which chimes like Big Ben. I have some code for playing the Imperial March and have tried to change it to suit. I would like to use an Arduino Uno to control this along with a RTC module. ( I know the error message says Arduino Mega 2560. This was the latest board I bought and was trying various projects that came with the kit.) Any help or thoughts to streamline would be appreciated.
const int c = 261;
const int d = 294;
const int e = 329;
const int f = 349;
const int g = 391;
const int gS = 415;
const int a = 440;
const int aS = 455;
const int b = 466;
const int cH = 523;
const int cSH = 554;
const int dH = 587;
const int dSH = 622;
const int eH = 659;
const int fH = 698;
const int fSH = 740;
const int gH = 784;
const int gSH = 830;
const int aH = 880;

const int buzzerPin = 8;

int counter = 0;

void setup()
{
//Setup pin modes
pinMode(buzzerPin, OUTPUT);
}

void loop()
{

//Play first section
firstSection();

//Play second section
secondSection();

//Play third section
thirdSection();

//Play fourth section
fourthSection();

//Variant 1
beep(aS, 500);
beep(g, 500);
beep(f, 500);
beep(d, 500);

delay(650);

//Variant 2
beep(f, 500);
beep(aS, 500);
beep(g, 500);
beep(d, 500);
beep(f, 500);
beep(g, 500);
beep(a, 500);
beep(f, 500);

delay(650);

//Variant 3
beep(aS, 500);
beep(f, 500);
beep(g, 500);
beep(d, 500);
beep(d, 500);
beep(g, 500);
beep(aS, 500);
beep(f, 500);
beep(aS, 500);
beep(g, 500);
beep(f, 500);
beep(d, 500);

delay(650);

//Variant 4
beep(f, 500);
beep(aS, 500);
beep(g, 500);
beep(d, 500);
beep(f, 500);
beep(g, 500);
beep(aS, 500);
beep(f, 500);
beep(aS, 500);
beep(f, 500);
beep(g, 500);
beep(d, 500);
beep(d, 500);
beep(g, 500);
beep(aS, 500);
beep(f, 500);

delay(650);
}

void beep(int note, int duration)
{
//Play tone on buzzerPin
tone(buzzerPin, note, duration);
}

//Stop tone on buzzerPin
noTone(buzzerPin);

delay(50);

//Increment counter
counter++;
}

void firstSection()
{
beep(aS, 500);
beep(g, 500);
beep(f, 500);
beep(d, 500);
delay(15000);
}

void secondSection()
{ beep(f, 500);
beep(aS, 500);
beep(g, 500);
beep(d, 500);
beep(f, 500);
beep(g, 500);
beep(a, 500);
beep(f, 500);

delay(15000);

}

void thirdSection()
{ beep(aS, 500);
beep(f, 500);
beep(g, 500);
beep(d, 500);
beep(d, 500);
beep(g, 500);
beep(aS, 500);
beep(f, 500);
beep(aS, 500);
beep(g, 500);
beep(f, 500);
beep(d, 500);

delay(15000);

void fourthSection()
{ beep(f, 500);
beep(aS, 500);
beep(g, 500);
beep(d, 500);
beep(f, 500);
beep(g, 500);
beep(aS, 500);
beep(f, 500);
beep(aS, 500);
beep(f, 500);
beep(g, 500);
beep(d, 500);
beep(d, 500);
beep(g, 500);
beep(aS, 500);
beep(f, 500);

delay(15000);
}

The issue I am having is below:
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\Christopher Howard\Documents\Arduino\winchseter_bells\winchseter_bells.ino: In function 'void loop()':

winchseter_bells:36:3: error: 'firstSection' was not declared in this scope

firstSection();

^~~~~~~~~~~~

winchseter_bells:41:1: error: expected primary-expression before ')' token

)

^

winchseter_bells:47:3: error: 'thirdSection' was not declared in this scope

thirdSection();

^~~~~~~~~~~~

winchseter_bells:50:3: error: 'fourthSection' was not declared in this scope

fourthSection();

^~~~~~~~~~~~~

C:\Users\Christopher Howard\Documents\Arduino\winchseter_bells\winchseter_bells.ino: At global scope:

winchseter_bells:116:9: error: expected constructor, destructor, or type conversion before '(' token

noTone(buzzerPin);

^

winchseter_bells:118:8: error: expected constructor, destructor, or type conversion before '(' token

delay(50);

^

winchseter_bells:121:3: error: 'counter' does not name a type

counter++;

^~~~~~~

winchseter_bells:122:1: error: expected declaration before '}' token

}

^

exit status 1

'firstSection' was not declared in this scope.

You need to pay close attention to your { and your }

Please remember to use code tags when posting code

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

You may be able to see where the { and } do not match if you use the IDE autoformat tool (ctrl-t or Tools, Auto Format).

These lines have to be inside a function and they are not. That caused 'firstSection()' to not be properly defined.

//Stop tone on buzzerPin
noTone(buzzerPin);


delay(50);


//Increment counter
counter++;
}