Algoritmo de Notas Musicales Para Pascal

8
PASCAL TURBO ALGORITMO PARA NOTAS MUSICALES: Uses Crt; Var CantNotas:array[1..50] of Longint; {Vector que almacena las notas} Frecuencia:array[1..7] of Longint; {Vector para las octavas} Var T:char; a,i,n,s,o:Word; Label z,y; Procedure Cuadro; Var g1:integer; Begin Textcolor(White); Gotoxy(2,2);Write('É'); Gotoxy(2,23);write('È'); Gotoxy(15,2);write('»');

Transcript of Algoritmo de Notas Musicales Para Pascal

Page 1: Algoritmo de Notas Musicales Para Pascal

PASCAL TURBO

ALGORITMO PARA NOTAS MUSICALES:

Uses Crt;

Var CantNotas:array[1..50] of Longint; {Vector que almacena las notas}

Frecuencia:array[1..7] of Longint; {Vector para las octavas}

Var T:char;

a,i,n,s,o:Word;

Label z,y;

Procedure Cuadro;

Var g1:integer;

Begin

Textcolor(White);

Gotoxy(2,2);Write('É');

Gotoxy(2,23);write('È');

Gotoxy(15,2);write('»');

Gotoxy(15,23);write('¼');

For g1:=3 To 14 Do

Page 2: Algoritmo de Notas Musicales Para Pascal

Begin

gotoxy(g1,2);write('Í');

gotoxy(g1,5);write('Í');

gotoxy(g1,8);write('Í');

gotoxy(g1,11);write('Í');

gotoxy(g1,14);write('Í');

gotoxy(g1,17);write('Í');

gotoxy(g1,20);write('Í');

gotoxy(g1,23);write('Í');

End;

for g1:=3 To 22 Do

Begin

Gotoxy(2,g1);Write('º');

Gotoxy(15,g1);Write('º');

End;

End;

Procedure N_0;

Begin

Frecuencia[1]:= 32;

Frecuencia[2]:= 36;

Frecuencia[3]:= 41;

Frecuencia[4]:= 44;

Page 3: Algoritmo de Notas Musicales Para Pascal

Frecuencia[5]:= 49;

Frecuencia[6]:= 55;

Frecuencia[7]:= 62;

End;

Procedure N_1; {Procedimento que cambia la frecuencia de las notas}

Begin

s:=Frecuencia[n];

For i:=1 to o do

Begin

s:=Frecuencia[n]*2;

End;

End;

Procedure N_2; {Procedimento para el sonido}

Begin

sound(s);

delay(100);

nosound;

a:=a+1;

End;

procedure N_3;

Begin

For i:=1 to a do

begin

Page 4: Algoritmo de Notas Musicales Para Pascal

sound(CantNotas[i]);

delay(200);

nosound;

delay(100);

end;

End;

BEGIN

N_0;

clrscr;

o:=3;

a:=0;

repeat

y:

Clrscr;

Cuadro;

Textcolor (White);

gotoxy (6,4); Writeln ('c=DO');

gotoxy (6,7); Writeln ('d=RE');

gotoxy (6,10); Writeln ('e=MI');

gotoxy (6,13); Writeln ('f=FA');

gotoxy (6,16); Writeln ('g=SOL');

gotoxy (6,19); Writeln ('a=LA');

gotoxy (6,22); Writeln ('b=SI');

Page 5: Algoritmo de Notas Musicales Para Pascal

Textcolor (Yellow);

gotoxy (32,8); Writeln ('Proyecto Examen de Recuperacion');

Textcolor (Red);

gotoxy (31,12); Writeln ('Notas que se estan almacenando: ',a);

Textcolor (White);

gotoxy (32,17); writeln ('Para aumentar de octava tecla +');

gotoxy (32,15); writeln ('Para disminuir de octava tecla -');

gotoxy (32,19); writeln ('Para Reproducir ''P''');

gotoxy (52,19); T:=readkey;

{Aumenta de octava}

if (T='+') and (o<5) and (o>0) then

Begin

o:= o+1;

End;

{Disminuye de octava}

if (T='-') and (o<5) and (o>0) then

Begin

o:=o-1;

End;

if T='c'then

begin

n:=1;

Page 6: Algoritmo de Notas Musicales Para Pascal

N_1;

N_2;

end;

if T='d'then

begin

n:=2;

N_1;

N_2;

end;

if T='e' then

begin

n:=3;

N_1;

N_2;

end;

if T='f' then

begin

n:=4;

N_1;

N_2;

end;

if T='g' then

begin

n:=5;

N_1;

N_2;

end;

Page 7: Algoritmo de Notas Musicales Para Pascal

if T='a' then

begin

n:=6;

N_1;

N_2;

end;

if T='b' then

begin

n:=7;

N_1;

N_2;

end;

if T='p' then

begin

N_3; goto z;

end;

CantNotas[a]:=s;

Until (T='s') or (a=50);

z:

Clrscr;

Gotoxy(27,5); Writeln('Para Salir Presione la Tecla ''t'' ');

Gotoxy(23,7); Write('Presione cualquier tecla para Continuar: ');

read(T);

If T='t' Then

Begin

Page 8: Algoritmo de Notas Musicales Para Pascal

Halt(1);

End

Else

Goto y;

END.