uses crt;
var x:char; i:longint;
o,d,r,m,f,s,l,si,t,st,sv,dv,lb:longint;
procedure sun(fr: longint);
begin
FOR I:=1 to 50 do begin
sound(fr); delay(dv);
end;
nosound; end;
begin
textbackground(green);
textcolor(white);
clrscr;
lb:=442;
st:=47; t:=2*st; o:=12*st;
repeat
if x=#72 then lb:=lb+st;
if (x=#80)and(lb>=st) then lb:=lb-st;
if x=#77 then lb:=lb+o;
if (x=#75)and(lb>=o) then lb:=lb-o;
d:=lb+3*st; r:=d+t; m:=r+t; f:=m+st; s:=f+t; l:=s+t; si:=l+t;
repeat
gotoxy(31,20);
writeln ('Nota la:',lb:10);
x:=readkey; dv:=700;
if (x=#75) or (x=#77) then dv:=1;
if (x=#72) or (x=#80) then dv:=1;
case x of
'q': sun(d+2*o);  'a': sun(d+o);  'z': sun(d);
'w': sun(r+2*o);  's': sun(r+o);  'x': sun(r);
'e': sun(m+2*o);  'd': sun(m+o);  'c': sun(m);
'r': sun(f+2*o);  'f': sun(f+o);  'v': sun(f);
't': sun(s+2*o);  'g': sun(s+o);  'b': sun(s);
'y': sun(l+2*o);  'h': sun(l+o);  'n': sun(l);
'u': sun(si+2*o); 'j': sun(si+o); 'm': sun(si);' ':nosound;
end;
until (x=#27) or(x=#72) or(x=#80) or(x=#75) or(x=#77);
until x = #27;
nosound;
end.

