< -->

Program Fourier_Transforms;
{$L C:\PROGRA~2\BP70\BIN\EGAVGA.OBJ}
{$E-,N+,G+}
Uses Graph, CRT;
Procedure EGAVGA; External;
const
  dimArr = 1023;
  dimFV = 1000;
  dx = 640/dimArr;
  dy = 240/65536;
  dy1 : Real = 230/65536;
  dx1 = 640/dimFV;
  Cns = 8192{10921} ;
  _Pi_ : Real = {3.1415926535897932384626433832795*}Cns/dimArr;
type
  TP = array[0..Cns] of Real;
  Real = Single;
var
  Val : array[0..dimArr] of Integer;
  FrqVal : array[0..dimArr-1] of Real;
  SmIm, SmRe, MaxF : Real;
  SmIm1, SmRe1 : Real;
  i, j, K: Word;
  tmp : Integer;
  tmpx : Real;
  P : ^TP;
  f : file;
  FSZ : Longint;
  D, R, e : Integer;
Procedure OutSpectr;
Function Max(Ar : array of Real) : Word;
var
  Mx : Word;
  j : Word;
begin
  Mx := 18;
  for j := 19 to dimArr-1 do
   if Ar[Mx]0 then
    dy1 := 230/MaxF
  else dy1 := 230/65535;
  MoveTo(0, 479-Round(dy1*FrqVal[0]));
  Sound(4*i);
  SetColor(LightRed);
  ClearDevice;
  for i := 0 to dimFV do
    LineTo(Round(dx1*i), 479-Round(dy1*FrqVal[i]));
end;
begin
  RegisterBGIDriver(@EGAVGA);
  InitGraph(D, R, '');
{  for i := 0 to dimArr do
    PutPixel(Round(dx*i), 120-Round(dy*Val[i]), Yellow);}
  GetMem(P, 65535);
  Assign(f, ParamStr(1));
  Reset(f, 2);
  FSZ := FileSize(f);
  Seek(f, 0);
  FSZ := (FSZ and $FFFFFFFE);
  for i := 0 to Cns do P^[i] := sin(2*3.1415926535897932384626433832795*i/Cns);
{  Randomize;}
  for k := 1 to FSZ div dimArr do
  begin
   BlockRead(f, Val, dimArr-1);
{   for i := 0 to dimArr do
     Val[i] := 32767-Random(65535)}
     {Round(32767*0.5*(sin(0.000*i*i)+cos(i*10)))};
   if KeyPressed then Break;
   OutSpectr;
  end;
  Close(f);
  FreeMem(P, 65535);
  ReadKey;
  NoSound;
  CloseGraph;
end.

Назад