home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol8n01.zip / NOISE.PAS < prev    next >
Pascal/Delphi Source File  |  1988-10-06  |  2KB  |  68 lines

  1. PROGRAM DEMO_for_NOISE;
  2. { Written by E. Kasey Kasemodel }
  3. {Delete the next line for TP3}
  4. USES Crt;
  5. VAR N : byte;
  6.  
  7.   PROCEDURE Noise(Start,   {starting frequency}
  8.                   Stop,    {ending frequency}
  9.                   Step,    {step size}
  10.                   Del,     {time per step}
  11.                   Times,   {repeats of whole sound}
  12.                   Pause    {pause between repeats}
  13.                   : Integer);
  14.   VAR
  15.     a, diff, z : Integer;
  16.   BEGIN
  17.        a := Start;
  18.     diff := 0;
  19.        z := 0;
  20.     FOR z := 1 TO Times DO
  21.       BEGIN
  22.         Sound(a); Delay(Del); NoSound; { make sound the first time }
  23.         REPEAT
  24.           IF Start > Stop THEN { noise goes down }
  25.             BEGIN
  26.               a := a-Step;    { take step value away from current freq }
  27.               diff := a-Stop; { check difference between freq and stop }
  28.             END
  29.           ELSE                { noise goes up }
  30.             BEGIN
  31.               a := a+Step;
  32.               diff := Stop-a;
  33.             END;
  34.           Sound(a); Delay(Del); NoSound; { produce updated sound }
  35.         UNTIL (diff < 0);     { keep looping til freq goes past stop }
  36.         a := Start;           { start over for another loop }
  37.         Delay(Pause);         { wait between loops }
  38.       END; {for z}            { do it again if necessary }
  39.   END;
  40.  
  41. BEGIN
  42.   ClrScr;
  43.   WriteLn('NOISE.PAS     By E. Kasey Kasemodel');
  44.  
  45.   Write('01 '); Noise(100, 50, 1, 15, 5, 100);    Delay(1000);
  46.   Write('02 '); Noise(100, 250, 10, 50, 3, 100);  Delay(1000);
  47.   Write('03 '); Noise(2000, 250, 50, 5, 2, 100);  Delay(1000);
  48.   Write('04 '); Noise(50, 2500, 50, 5, 4, 50);    Delay(1000);
  49.  
  50.   Write('05 '); Noise(4000, 1000, 150, 3, 3, 50);
  51.                 Noise(1000, 4000, 150, 3, 3, 50); Delay(1000);
  52.  
  53.   Write('06 '); Noise(1000, 6000, 100, 3, 3, 50);
  54.                 Noise(4000, 250, 80, 3, 2, 75);
  55.                 Noise(50, 5500, 133, 4, 2, 25);
  56.                 Noise(2000, 1000, 60, 3, 3, 50);  Delay(1000);
  57.  
  58.   Write('07 '); Noise(2000, 2400, 2, 2, 2, 50);   Delay(1000);
  59.  
  60.   Write('08 '); FOR N := 1 to 8 DO
  61.                   BEGIN
  62.                     Noise(1000, 2000, 15, 2, 1, 0);
  63.                     Noise(2000, 1000, 15, 2, 1, 0);
  64.                   END;                            Delay(1000);
  65.   Write('09 '); Noise(1000,2000, 500, 2, 200, 0);
  66.  
  67. END.
  68.