program trabalhofinal; uses crt; var cores:array[1..6,1..2] of integer; movimento,sn,entra,partiturator:char; posicao,opcao,d,x,f,oitava:integer; a:char; amostra:array[1..40]of string; m,n,k,bpm,t,lock,nota,conta,escvar,figu,tempo,list,sobe:integer; vet:array[1..2,1..40]of integer; pos:array[1..2,1..40]of integer; figura:array[1..40]of integer; noi:array[0..12]of string; const do2=131; reb2=139; re2=147; mib2=156; mi2=165; fa2=175; solb2=185; sol2=196; lab2=208; la2=220; sib2=233; si2=247; do3=262; reb3=278; re3=294; mib3=312; mi3=330; fa3=350; solb3=370; sol3=392; lab3=416; la3=440; sib3=466; si3=494; do4=524; reb4=556; re4=588; mib4=624; mi4=660; fa4=700; solb4=740; sol4=784; lab4=832; la4=880; sib4=932; si4=988; do5=1048; procedure about; begin textmode(3); nosound; textbackground(1); textcolor(14); clrscr; gotoxy(27,2); writeln('Programa desenvolvido por:'); textcolor(2); gotoxy(18,3); writeln('Andre Luiz Medeiros dos Santos - 1022051-3'); textcolor(14); gotoxy(1,20); writeln('Curso ------> Engenharia Eletrica'); writeln('Disciplina --> Introducao a Computacao'); writeln('Professora --> Ana Paula'); readkey; end; procedure explanacao; begin clrscr; gotoxy(1,2); writeln(' Sobre as figuras de tempo:'); writeln('nesse programa a unidade de tempo sera sempre a seminima(4);'); writeln('cada figura subsequente vale a metade da anterior;'); writeln('exemplo: com bpm 120, cada nota com a figura de seminima durara 0,5'); writeln('segundos, uma nota com figura de minima durara 1 segundo (dobro da seminima)'); writeln('e uma nota com figura de colcheia durara 0,25 segundos (metade da seminima)'); writeln('o programa nao escreve pausas e nao escreve tercinas.'); writeln; writeln(' Sobre o tom:'); writeln('nesse programa so escreve-se melodias no tom de DO MAIOR,'); writeln('se vc tem uma melodia em outro tom transponha-a primeiro;'); writeln('do mesmo modo que so escreve-se na clave de sol (G) na segunda linha,'); writeln('isso significa que a nota na segunda linha de baixo pra cima eh sol a nota'); writeln('no espaco em cima da segunda linha eh o la e na linha em cima desse espaco'); writeln('tem-se o si, e assim sucessivamente tao ascendentemente quanto descendentemente'); writeln('encontramos as notas periodicamente DO-RE-MI-FA-SOL-LA-SI;'); writeln('o limite superior eh o DO na segunda linha suplementar superior'); writeln('e o limite inferior eh o SOL no terceiro espaco suplementar inferior.'); writeln('o limite de notas por melodia eh de 40 notas.'); writeln; writeln(' Espera-se que logo na proxima versao, o programa ja escreva'); writeln('em outras claves, em outros tons, pausas e tercinas.'); gotoxy(35,25); write(''); readkey; end; begin about; textmode(3); nosound; textbackground(1); textcolor(14); clrscr; gotoxy(26,8); textcolor(10+blink); writeln('Kramer`s SONIFICATOR SUITE'); gotoxy(36,9); writeln('v.1.99'); textcolor(14); gotoxy(35,11); write(''); gotoxy(1,25); textcolor(7); write('Obs: Este software NAO possui qualquer ligacao com as Organizacoes Tabajara'); readkey; repeat cores[1,1]:=4; cores[1,2]:=14; cores[2,1]:=1; cores[3,1]:=1; cores[4,1]:=1; cores[5,1]:=1; cores[6,1]:=1; cores[2,2]:=15;cores[3,2]:=15;cores[4,2]:=15;cores[5,2]:=15;cores[6,2]:=15; posicao:=1; repeat clrscr; textbackground(blue); clrscr; textcolor(white); writeln(' Escolha a opcao desejada'); writeln; writeln; writeln; writeln; writeln(' ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»'); write(' º'); textbackground(cores[1,1]); textcolor(cores[1,2]); write(' PERSONAL PARTITURATOR '); textbackground(blue); textcolor(white); writeln('º'); write(' º'); textbackground(cores[2,1]); textcolor(cores[2,2]); write(' METRONOMO TABAHARA '); textbackground(blue); textcolor(white); writeln('º'); write(' º'); textbackground(cores[3,1]); textcolor(cores[3,2]); write(' FREQUENCIA VERIFICATOR'); textbackground(blue); textcolor(white); writeln('º'); write(' º'); textbackground(cores[4,1]); textcolor(cores[4,2]); write(' TOCANOTA AFINATOR '); textbackground(blue); textcolor(white); writeln('º'); write(' º'); textbackground(cores[5,1]); textcolor(cores[5,2]); write(' SIMPSONS TEMIFICATOR '); textbackground(blue); textcolor(white); writeln('º'); write(' º'); textbackground(cores[6,1]); textcolor(cores[6,2]); write(' NADA '); textbackground(blue); textcolor(white); writeln('º'); write(' ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ'); gotoxy(1,25); textcolor(7); write('F1 -> about'); textcolor(15); movimento:=readkey; if (movimento=#59) then about; if (movimento=#80) then posicao:=posicao+1; if (movimento=#72) then posicao:=posicao-1; if posicao=0 then posicao:=6; if posicao=7 then posicao:=1; if posicao=1 then begin cores[1,1]:=4; cores[1,2]:=14; cores[2,1]:=1; cores[3,1]:=1; cores[4,1]:=1; cores[5,1]:=1; cores[6,1]:=1; cores[2,2]:=15;cores[3,2]:=15;cores[4,2]:=15;cores[5,2]:=15;cores[6,2]:=15; opcao:=1; end; if posicao=2 then begin cores[2,1]:=4; cores[2,2]:=14; cores[1,1]:=1; cores[3,1]:=1; cores[4,1]:=1; cores[5,1]:=1; cores[6,1]:=1; cores[1,2]:=15;cores[3,2]:=15;cores[4,2]:=15;cores[5,2]:=15;cores[6,2]:=15; opcao:=2; end; if posicao=3 then begin cores[3,1]:=4; cores[3,2]:=14; cores[1,1]:=1; cores[2,1]:=1; cores[4,1]:=1; cores[5,1]:=1; cores[6,1]:=1; cores[1,2]:=15;cores[2,2]:=15;cores[4,2]:=15;cores[5,2]:=15;cores[6,2]:=15; opcao:=3; end; if posicao=4 then begin cores[4,1]:=4; cores[4,2]:=14; cores[1,1]:=1; cores[2,1]:=1; cores[3,1]:=1; cores[5,1]:=1; cores[6,1]:=1; cores[1,2]:=15;cores[2,2]:=15;cores[3,2]:=15;cores[5,2]:=15;cores[6,2]:=15; opcao:=4; end; if posicao=5 then begin cores[5,1]:=4; cores[5,2]:=14; cores[1,1]:=1; cores[2,1]:=1; cores[3,1]:=1; cores[4,1]:=1; cores[6,1]:=1; cores[1,2]:=15;cores[2,2]:=15;cores[3,2]:=15;cores[4,2]:=15;cores[6,2]:=15; opcao:=5; end; if posicao=6 then begin cores[6,1]:=4; cores[6,2]:=14; cores[1,1]:=1; cores[2,1]:=1; cores[3,1]:=1; cores[4,1]:=1; cores[5,1]:=1; cores[1,2]:=15;cores[2,2]:=15;cores[3,2]:=15;cores[4,2]:=15;cores[5,2]:=15; opcao:=6; end; until movimento=#13; if opcao=1 then begin repeat clrscr; gotoxy(30,2); textcolor(14); writeln('Personal Partiturator'); textcolor(15); gotoxy(1,5); writeln(' Personal Partiturator eh um programa onde voce escreve uma melodia'); writeln('em uma partitura e depois de escrever pode ouvi-la.'); writeln(' A operacao do programa eh simples: primeiro entre com a pulsacao(bpm) em que'); writeln('incidira a unidade de tempo (seminima), depois escolhe-se uma figura musical'); writeln('pelo codigo padrao musical e depois movimenta a nota pela partitura'); writeln('pelas setas ate a altura (posicao) desejada e aperta '); writeln('apos entrar com todas as notas desejadas entre com 0 no codigo de'); writeln('figuras musicais e o Personal Partiturator tocara a melodia.'); writeln(' Se vc errar a figura desejada, antes de entrar com a altura, aperte '); writeln('para voltar e entrar um novo valor de figura.'); writeln; writeln('O padrao musical dos codigos das figuras de tempo eh o seguinte:'); writeln('1 -> semibreve'); writeln('2 -> minima'); writeln('4 -> seminima'); writeln('8 -> colcheia'); writeln('16 -> semicolcheia'); writeln('32 -> fusa'); writeln('64 -> semifusa'); writeln; textcolor(7); writeln('F1 -> mais informacoes -> Personal Partiturator'); textcolor(15); partiturator:=readkey; if (partiturator=#59) then explanacao; until partiturator=#13; textmode(3); textbackground(1); textcolor(7); clrscr; list:=1; k:=1; m:=2; n:=14; writeln('Escolha o andamento aproximado (em bpm):'); readln(bpm); t:=round(60000/bpm); repeat sobe:=0; clrscr; writeln('Entre com o codigo da figura desejada:'); gotoxy(1,10); writeln('-------------------------------------------------------------------------------'); writeln; writeln('-------------------------------------------------------------------------------'); writeln; writeln('-------------------------------------------------------------------------------'); writeln('G'); writeln('-------------------------------------------------------------------------------'); writeln; writeln('-------------------------------------------------------------------------------'); gotoxy(1,25); textcolor(14); write('Quando estiver pronto para ouvir entre com 0 como codigo de figura'); textcolor(7); for escvar:=1 to 40 do begin if ((pos[1,escvar])<>0) and ((pos[2,escvar])>5) and ((pos[2,escvar]<24)) then begin gotoxy(pos[1,escvar],pos[2,escvar]); write(chr(14)); if pos[2,escvar]=8 then begin gotoxy((pos[1,escvar]-1),pos[2,escvar]); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if pos[2,escvar]=7 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]+1)); if vet[1,39]<>0 then write('--') else write('---'); end; if pos[2,escvar]=6 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]+2)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((pos[1,escvar]-1),pos[2,escvar]); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if pos[2,escvar]=20 then begin gotoxy((pos[1,escvar]-1),pos[2,escvar]); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if pos[2,escvar]=21 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]-1)); if vet[1,39]<>0 then write('--') else write('---'); end; if pos[2,escvar]=22 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]-2)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((pos[1,escvar]-1),(pos[2,escvar])); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if pos[2,escvar]=23 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]-3)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((pos[1,escvar]-1),(pos[2,escvar]-1)); if vet[1,39]<>0 then write('--') else write('---'); end; gotoxy(pos[1,escvar],24); case figura[escvar] of 1: textcolor(14); 2: textcolor(3); 4: textcolor(4); 8: textcolor(10); 16:textcolor(15); 32:textcolor(13); 64:textcolor(6); end; write(amostra[escvar]); textcolor(7); end; end; gotoxy(1,2); read(figu); if (figu=1) or (figu=2) or (figu=4) or(figu=8) or (figu=16)or (figu=32)or (figu=64) then figura[list]:=figu; if figu=1 then begin tempo:=round(t*4); vet[2,list]:=tempo; amostra[list]:='1'; end; if figu=2 then begin tempo:=round(t*2); vet[2,list]:=tempo; amostra[list]:='2'; end; if figu=4 then begin tempo:=round(t); vet[2,list]:=tempo; amostra[list]:='4'; end; if figu=8 then begin tempo:=round(t/2); vet[2,list]:=tempo; amostra[list]:='8'; end; if figu=16 then begin tempo:=round(t/4); vet[2,list]:=tempo; amostra[list]:='16'; end; if figu=32 then begin tempo:=round(t/8); vet[2,list]:=tempo; amostra[list]:='32'; end; if figu=64 then begin tempo:=round(t/16); vet[2,list]:=tempo; amostra[list]:='64'; end; if (figu=1) or (figu=2) or (figu=4) or(figu=8) or (figu=16)or (figu=32)or (figu=64) then if vet[1,40]=0 then begin gotoxy(m,n); textcolor(7+blink); write(chr(14)); if n=8 then begin gotoxy((m-1),n); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if n=7 then begin gotoxy((m-1),(n+1)); if vet[1,39]<>0 then write('--') else write('---'); end; if n=6 then begin gotoxy((m-1),(n+2)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((m-1),n); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if n=20 then begin gotoxy((m-1),n); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if n=21 then begin gotoxy((m-1),(n-1)); if vet[1,39]<>0 then write('--') else write('---'); end; if n=22 then begin gotoxy((m-1),(n-2)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((m-1),(n)); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if n=23 then begin gotoxy((m-1),(n-3)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((m-1),(n-1)); if vet[1,39]<>0 then write('--') else write('---'); end; textcolor(7); lock:=1; repeat a:=readkey; if a=#75 then m:=m; if a=#77 then begin m:=m; lock:=0; end; if (a=#72) and (n>6)then begin n:=n-1; lock:=0; end; if (a=#80) and (n<23)then begin n:=n+1; lock:=0; end; clrscr; writeln('Entre com o codigo da figura desejada:'); gotoxy(1,10); writeln('-------------------------------------------------------------------------------'); writeln; writeln('-------------------------------------------------------------------------------'); writeln; writeln('-------------------------------------------------------------------------------'); writeln('G'); writeln('-------------------------------------------------------------------------------'); writeln; writeln('-------------------------------------------------------------------------------'); gotoxy(1,25); textcolor(14); write('Quando estiver pronto para ouvir entre com 0 como codigo de figura'); textcolor(7); for escvar:=1 to 40 do begin if ((pos[1,escvar])<>0) and ((pos[2,escvar])>5) and ((pos[2,escvar]<24)) then begin gotoxy(pos[1,escvar],pos[2,escvar]); write(chr(14)); if pos[2,escvar]=8 then begin gotoxy((pos[1,escvar]-1),pos[2,escvar]); write('-',chr(14),'-'); end; if pos[2,escvar]=7 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]+1)); write('---'); end; if pos[2,escvar]=6 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]+2)); write('---'); gotoxy((pos[1,escvar]-1),pos[2,escvar]); write('-',chr(14),'-'); end; if pos[2,escvar]=20 then begin gotoxy((pos[1,escvar]-1),pos[2,escvar]); write('-',chr(14),'-'); end; if pos[2,escvar]=21 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]-1)); write('---'); end; if pos[2,escvar]=22 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]-2)); write('---'); gotoxy((pos[1,escvar]-1),(pos[2,escvar])); write('-',chr(14),'-'); end; if pos[2,escvar]=23 then begin gotoxy((pos[1,escvar]-1),(pos[2,escvar]-3)); write('---'); gotoxy((pos[1,escvar]-1),(pos[2,escvar]-1)); write('---'); end; gotoxy(pos[1,escvar],24); case figura[escvar] of 1: textcolor(14); 2: textcolor(3); 4: textcolor(4); 8: textcolor(10); 16:textcolor(15); 32:textcolor(13); 64:textcolor(6); end; write(amostra[escvar]); textcolor(7); end; end; gotoxy(m,n); textcolor(7+blink); write(chr(14)); if n=8 then begin gotoxy((m-1),n); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if n=7 then begin gotoxy((m-1),(n+1)); if vet[1,39]<>0 then write('--') else write('---'); end; if n=6 then begin gotoxy((m-1),(n+2)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((m-1),n); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if n=20 then begin gotoxy((m-1),n); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if n=21 then begin gotoxy((m-1),(n-1)); if vet[1,39]<>0 then write('--') else write('---'); end; if n=22 then begin gotoxy((m-1),(n-2)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((m-1),(n)); if vet[1,39]<>0 then write('-',chr(14)) else write('-',chr(14),'-'); end; if n=23 then begin gotoxy((m-1),(n-3)); if vet[1,39]<>0 then write('--') else write('---'); gotoxy((m-1),(n-1)); if vet[1,39]<>0 then write('--') else write('---'); end; textcolor(7); if lock=0 then begin case n of 6 : nota:=do5; 7 : nota:=si4; 8 : nota:=la4; 9 : nota:=sol4; 10: nota:=fa4; 11: nota:=mi4; 12: nota:=re4; 13: nota:=do4; 14: nota:=si3; 15: nota:=la3; 16: nota:=sol3; 17: nota:=fa3; 18: nota:=mi3; 19: nota:=re3; 20: nota:=do3; 21: nota:=si2; 22: nota:=la2; 23: nota:=sol2; end; lock:=1; if (n>5) and (n<24) then begin sound(nota); delay(tempo); nosound; end; end; if (a=#13) and (n>5) and (n<24) and (m<81) then begin vet[1,k]:=nota; pos[1,k]:=m; pos[2,k]:=n; k:=k+1; m:=m+2; list:=list+1; sobe:=1; end; until (a=#27) or (vet[1,40]<>0) or (m>80) or (sobe=1); end; until figu=0; for conta:=1 to 40 do begin if (vet[1,conta]<>0) and (vet[2,conta]<>0)then begin sound (vet[1,conta]); delay(vet[2,conta]); nosound; end; end; clrscr; for conta:=1 to 40 do begin vet[1,conta]:=0; vet[2,conta]:=0; pos[1,conta]:=0; pos[2,conta]:=0; end; end; if opcao=2 then begin clrscr; gotoxy(31,2); textcolor(14); writeln('Metronomo Tabahara'); textcolor(15); gotoxy(10,7); writeln('Metronomo Tabahara eh um metronomo facil e simples de se usar'); gotoxy(4,8); writeln('Voce entra com o bpm (batidas por minuto) e ele toca a pulsacao desejada'); gotoxy(35,11); writeln(''); readkey; repeat clrscr; write('Entre com o bpm: '); readln(bpm); d:=(round(60000/bpm)); repeat write('-'); sound(440); delay(1); nosound; delay(d); until (keypressed) or (entra=#13); writeln; writeln(''); readln; write('Deseja entrar nova pulsacao?? (s/n) '); read(sn); until (sn='n') or (sn='N'); end; if opcao=3 then begin ClrScr; gotoxy(29,2); textcolor(14); Writeln('Frequencia Verificator'); textcolor(15); Writeln; Writeln; Writeln(' Este programa imprime uma tabela com a frequˆncia das notas.'); Gotoxy(35,10); Writeln(''); Gotoxy(3,25); Writeln('Nesta tabela o LA padrao, LA da oitava 3 (la3), possui frequencia de 440Hz'); Readkey; noi[0]:='do ';noi[1]:='do# ';noi[2]:='re ';noi[3]:='re# ';noi[4]:='mi '; noi[5]:='fa ';noi[6]:='fa# ';noi[7]:='sol ';noi[8]:='sol#'; noi[9]:='la ';noi[10]:='la# ';noi[11]:='si ';noi[12]:='do '; Repeat clrscr; Writeln('Digite o numero da oitava desejada.'); Readln(oitava); For x:=0 to 12 do Writeln(noi[x],'--->',(round(exp(oitava*ln(2))))*(round((131/4)*exp((x/12)*ln(2)))),' Hz'); Write('Deseja continuar? (s/n)'); Readln(sn); Until (sn='n') or (sn='N'); end; if opcao=4 then begin ClrScr; Gotoxy(31,2); Textcolor(14); Write('Tocanota Afinator'); Textcolor(15); Gotoxy(1,6); Writeln('Este programa toca uma frequencia determinada...'); Writeln('Muito util como afinador!'); Gotoxy(35,10); Write(''); Readkey; f:=1; While f<>0 do Begin Clrscr; Write('Entre com a frequˆncia: '); Gotoxy(1,23); Writeln('Para ouvir uma nota especifica confira a'); Writeln('frequencia com o FREQUENCIA VERIFICATOR'); textcolor(11); Write('Entre com a frequencia 0 para terminar'); textcolor(15); Gotoxy(25,1); Readln(f); Sound(f); Delay(1000); NoSound; End; end; if opcao=5 then begin clrscr; gotoxy(30,2); textcolor(14); writeln('Simpsons Temificator'); textcolor(15); gotoxy(25,6); write('Aqui vc ouve um exemplo musical'); gotoxy(17,8); write('Tecle e ouca o tema de `Os Simpsons`'); gotoxy(37,24); textcolor(6); write('D`OH!'); textcolor(15); readkey; Sound(262); Delay(450); Sound(330); Delay(300); Sound(370); Delay(300); Sound(440); Delay(150); Sound(392); Delay(450); Sound(330); Delay(300); Sound(262); Delay(300); Sound(220); Delay(150); Sound(185); Delay(150); NoSound; Sound(185); Delay(150); NoSound; Sound(185); Delay(150); Sound(196); Delay(150); NoSound; Delay(750); Sound(185); Delay(150); NoSound; Sound(185); Delay(150); NoSound; Sound(185); Delay(150); Sound(196); Delay(150); Sound(233); Delay(450); Sound(262); Delay(150); NoSound; Sound(262); Delay(150); NoSound; Sound(262); Delay(150); NoSound; Sound(262); Delay(150); NoSound; end; until posicao=6; end.