Look at this first part
tone(Alarm, 440);
delay(500);
noTone(Alarm);
delay(200);
tone(Alarm, 440);
delay(500);
noTone(Alarm);
delay(200);
tone(Alarm, 440);
delay(500);
noTone(Alarm);
delay(200);
tone(Alarm, 349);
delay(350);
noTone(Alarm);
delay(100);
tone(Alarm, 523);
delay(150);
noTone(Alarm);
delay(50);
This is the same 4 lines repeated over and over. Only the numbers change. Those numbers could be stored in arrays:
const int note[] = {440, 440, 440, 349, 523, ...};
const int duration[] = {500, 500, 500, 350, 150, ...};
const int pause[] = {200, 200, 200, 100, 50, ...};
Then, the loop can play them back:
if ((Alarmzeit==Zeit) && (Modus==0) && (digitalRead(LEDrot)==HIGH)) {
int n = 0;
while (digitalRead(LEDrot)==HIGH && n < sizeof(note)/sizeof(note[0])){
tone(Alarm, note[n]);
delay(duration[n]);
noTone(Alarm);
delay(pause[n]);
n++;
}
}
The loop stops when it has played all the notes or the button is pressed.