{Play sounds on F1 - F10 keys like on a piano keyboard}
{Made 2000-09-27}

uses crt;
const F1=#59; F2=#60; F3=#61; F4=#62; F5=#63; F6=#64; F7=#65; F8=#66;
F9=#67; F10=#68;
cf1=#94;cf2=#95;cf3=#96;cf4=#97;cf5=#98;cf6=#99;cf7=#100;cf8=#101;cf9=#102;
cf10=#103;
Esc=#27;
Null=#0;
var x:char; ext:boolean;  
function getkey:char;
var x:char;
begin
ext:=false;
x:=readkey;
if x=Null then begin
ext:=true;
x:=readkey
end;
getkey:=x;
end;
begin clrscr; 
writeln;
writeln('                             Welcome to MusicBox!');
writeln;
writeln('Now you can get music with your keyboard, the keys F1 - F10 of which are the');
writeln('scale. To continue the scale and get higher sounds press Ctrl+F1, F2, ...,');
writeln('F10. To quit, press Esc.');
writeln;
writeln('IT`S INTERESTING. Some keys on your keyboard being pressed can produce sound');
writeln('too. Those sounds are the same that you have in your scale. Try to find them!');
writeln;writeln;writeln;writeln;writeln;writeln;writeln;
writeln;writeln;writeln;writeln;writeln;writeln;writeln;
writeln('Made by Nick Kriukov 09.27.2000');
repeat
x:=getkey;
case x of
F1: begin sound(262); delay(1500); nosound; end;
F2: begin sound(294); delay(1500); nosound; end;
F3: begin sound(330); delay(1500); nosound; end;
F4: begin sound(349); delay(1500); nosound; end;
F5: begin sound(392); delay(1500); nosound; end;
F6: begin sound(440); delay(1500); nosound; end;
F7: begin sound(494); delay(1500); nosound; end;
F8: begin sound(523); delay(1500); nosound; end;
F9: begin sound(587); delay(1500); nosound; end;
F10:begin sound(659); delay(1500); nosound; end;
cf1:begin sound(698); delay(1500); nosound; end;
cf2:begin sound(785); delay(1500); nosound; end;
cf3:begin sound(880); delay(1500); nosound; end;
cf4:begin sound(988); delay(1500); nosound; end;
cf5:begin sound(1047);delay(1500); nosound; end;
cf6:begin sound(1174);delay(1500); nosound; end;
cf7:begin sound(1318);delay(1500); nosound; end;
cf8:begin sound(1396);delay(1500); nosound; end;
cf9:begin sound(1568);delay(1500); nosound; end;
cf10:begin sound(1760);delay(1500);nosound; end;
end;
until(x=Esc);
end.
