home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / msdos / sndbords / proaudio / freq3 / freq.txt < prev    next >
Text File  |  1993-10-07  |  10KB  |  226 lines

  1. FREQ.EXE:
  2.  
  3. FREQ.EXE is a program for the ProAudio Spectrum/Studio 16 sound cards.
  4. It samples the input, performs an FFT, and graphs the output.  
  5. INI file and command line options provide the user with the ability to 
  6. select linear/log frequency and amplitude scales as well as sampling rates, 
  7. length of the FFT, and windowing functions.  This program will run on any
  8. 8086 compatible computer.  Graphics is done using the Borland .BGI drivers, 
  9. so the file EGAVGA.BGI is required to be in either the same directory as 
  10. the executable or in the directory c:\borlandc\bgi.  
  11.  
  12. FREQ386.EXE:
  13.  
  14. FREQ386.EXE is the same as FREQ.EXE, except it has been compiled with full 
  15. optimization and 80386 code enabled, so you will need at least an 80386 
  16. processor to run it.  This program will perform and plot 1024 point FFTs at
  17. a rate of 35 per second on a 486/33 and 512 point FFTs at a rate of 70 per second.  
  18. (On a 486/33 with small memory model, a 1024 point FFT takes 16.5ms.)  
  19. The program allows up to 2048 point FFTs (or higher if you change the source 
  20. slightly).  
  21.  
  22. FILE LIST:
  23.  
  24. FREQ.EXE     executable program, described above
  25. FREQ386.EXE  executable program, described above
  26. FREQ.TXT     (you are reading it)
  27. FREQ.INI     initialization file for FREQ.EXE/FREQ386.EXE
  28. EGAVGA.BGI   Borland graphics library file
  29. *.C,*.H      C source for the above programs
  30. FREQ.PRJ     Project file used for Borland C++ (version 3.1)
  31.  
  32. Of these files, only FREQ.EXE (or FREQ386.EXE) and EGAVGA.BGI are required
  33. to run the program.  FREQ.INI is optional (it is used to set up default
  34. parameters and color scheme).  The other files are the source code, and can
  35. be deleted without affecting program operation.
  36.  
  37. COMMAND LINE OPTIONS:
  38.  
  39. -Snumber sets the sampling rate.
  40. -Fnumber sets the length of the FFT.
  41. -Mnumber sets the scale maximum.
  42. -Bnumber sets the logarithmic base level (in tens of dB).
  43. -Tnumber sets the logarithmic top level (in tens of dB).
  44. -Gnumber sets the dB/octave gain factor.
  45. -Rnumber sets the reference frequency for dB/octave gains.
  46. -LA sets a logarithmic scale for the amplitude axis.
  47. -LF sets a logarithmic scale for the frequency axis.
  48. -W0 selects a Hamming window.  (offset sine) <--default
  49. -W1 selects a Hanning window.  (sine)
  50. -W2 selects a Blackman window. (two sines)
  51. -W3[,alpha] selects a Gaussian window.
  52. -W4 selects a Welch window.    (quadratic)
  53. -W5 selects a Parzen window.   (triangular)
  54. -W6 selects a Rectangular window.
  55. -Wfilename saves the windowing function to the specified file.
  56. -? or -H displays this message.
  57.  
  58. INI File options: 
  59.  
  60. These options override the program defaults, but are overridden by the 
  61. options specified on the command line.  The red,green,blue values for the
  62. colors must be values between 0 and 63.
  63.  
  64. Sample rate: 44100          ( same as -Snumber )
  65. FFT length: 1024            ( same as -Fnumber )
  66. Window function: 0          ( same as -Wnumber )
  67. Log freq scale: 0           ( 1 = -LF )
  68. Log amp scale: 1            ( 1 = -LA )
  69. Base db: 7                  ( same as -Bnumber )
  70. Top db: 2                   ( same as -Tnumber )
  71. Max amp: 10                 ( same as -Mnumber )
  72. DB/octave gain: 0           ( same as -Gnumber )
  73. Reference frequency: 1000   ( same as -Rnumber )
  74. Background color: 0,0,20    ( sets the background red,green,blue value )
  75. Clipping warning color: 20,0,0 (sets the background color for when clipping occurs )
  76. Graph color: 30,35,60       ( sets the color for the FFT graph )
  77. Axis label color: 50,20,45  ( sets the color frequency and amplitude labels )
  78. Border color: 40,40,40      ( sets the color for the border and tick marks )
  79. Text color: 55,55,25        ( sets the color for text (other than labels) )
  80. Cursor upper color: 20,20,20 ( sets the color for the upper half of the cursor )
  81. Cursor lower color: 63,63,63 ( sets the color for the lower half of the cursor )
  82.  
  83. RUNTIME OPTIONS:
  84.  
  85. While the program is running, the following commands may be used:
  86.  
  87. E,Q,<ESC> : exit from the program
  88. W : toggle windowing function
  89. X : toggle between logarithmic and linear frequency (x axis) scales
  90. Y : toggle between logarithmic (dB) and linear amplitude (y axis) scales
  91. 0 : select 0 db/octave gain
  92. 3 : select 3 db/octave gain
  93. 6 : select 6 db/octave gain
  94. 9 : select 9 db/octave gain
  95. 1 : select 12 db/octave gain
  96. <arrows> : increase/decrease the amplitude scale
  97.  
  98. <space> : freeze display, put up a cursor, and put up a display of frequency,
  99. phase, and amplitude information.  In this mode, the left and right arrows
  100. with move the cursor, <CTRL>-arrows will move in larger steps, <space> will
  101. resume data aquisition, and <ESC>,'Q','E' with exit to DOS.
  102.  
  103. THE WINDOWING FUNCTION:
  104.  
  105. Several different windowing functions are available.  The windowing function
  106. is a function that is multiplied by the input data to reduce the effects of
  107. the discontinuity at the ends of the data set.  A rectangular window is 
  108. actually no window: all data is passed through.  A Parzen (triangular) window 
  109. uses a trianglar weighting: the end points are multiplied by 0, the
  110. middle point by 1, with a linear ramp from 0 to 1 and back to 0 again.
  111. A Welch Window uses a quadratic weighting: the end points are multiplied by
  112. 0, the middle points by 1, with a [concave down] quadratic function from 0,
  113. up to 1, and back down to 0 again. To see the shapes of the various windows, 
  114. used the -Wfilename option, and plot the data in the output file.
  115.  
  116. The best way to see the effects of windows is to use a logarithmic amplitude
  117. scale, and input a sine wave (an audio test CD works great for this).  If 
  118. you don't have any good sine wave sources, whistling into a mic works fairly
  119. well.
  120.  
  121. KNOWN PROBLEMS: (let me know if you find others)
  122.  
  123. 1) The program does not work if the 'device=mvsound.sys' line in config.sys 
  124. contains the switch "u" (this switch allows initialization of the card, but 
  125. then the driver is unloaded from memory (not a TSR)).  Removing this switch 
  126. solves the problem.  My config.sys contains the following line:
  127.    devicehigh=c:\pastudio\mvsound.sys d:5 q:7 s:1,220,1,5 j:1 t:1 v:0
  128.  
  129. 2) The actual sample rates must be integer divisions of the timer frequency,
  130. 1.19318 MHz.  This means actual sampling rates are:
  131.    91.78kHz, 85.23kHz, 79.55kHz, 74.57kHz, 70.19kHz, 66.29kHz, 62.80kHz,
  132.    59.66kHz, ... , 45.89kHz, 44.19kHz, 42.61kHz, etc.
  133. The displayed sample rates will not reflect actual values unless the command
  134. line option specifies a rate that is an integral division of 1.19318 MHz.
  135.  
  136. THE SOURCE:
  137.  
  138. To compile the source you will also need the PAS SDK (SDK-V3.ZIP or 
  139. PASSDK30.ZIP) that can be found via ftp on ProAudio archive sites such as
  140. /ftp.uwp.edu:pub/msdos/proaudio.  It can also be found on Media Vision's 
  141. bulletin board (files DISK1.ZIP and DISK2.ZIP), and on Compuserve in the 
  142. Media Vision forum (SDK-V3.ZIP).
  143.  
  144. You will also need Borland C++ since the program uses the Borland .BGI
  145. graphics facilities, but this should be easy to convert to the Microsoft C
  146. (or other) graphics facilities.
  147.  
  148. WHAT'S NEW IN VERSION TWO:
  149.  
  150. 1) The FFT routine has been changed to process purely real data, which can be
  151. done in about half of the time it takes to process complex data.  This makes 
  152. the FFT routine a little messy, but it is worth the mess!
  153.  
  154. 2) The screen updating routine was changed a bit, and now runs faster
  155. than before.  The main change was setting the mode and color once when the 
  156. program starts, instead of every time a line was drawn.  This works
  157. because I am interesting in drawing one color only, and nothing else is 
  158. trying to output to the display while the program is running.
  159.  
  160. 3) Changed the square root code to use a Newton-Raphson method.
  161.  
  162. 4) Filled in the gaps in plots (such as log frequency scale).
  163.  
  164. 5) A version is included which runs on only 386+ machines with COPROCESSORS.
  165. This program is even faster than the other version because it was written
  166. in 386/387 assembly code.
  167.  
  168. 6) Removed Bartlett window function (it is essentially the same as the Parzen
  169. window function).
  170.  
  171. 7) Added cursor/amplitude display during paused display.
  172.  
  173. WHAT'S NEW IN VERSION THREE:
  174.  
  175. 1) Skipped the assembly language version (it is too difficult to keep up with
  176. the changes in two versions of the program).  The version optimized for the 
  177. 386 runs as fast as the eye can see, anyway, so there was not much gain it
  178. going real time.
  179.  
  180. 2) Added checking so that lines do not go beyond the limits of the display.
  181.  
  182. 3) Added options for 0,3,6,9,12 dB/octave gains so that higher harmonics can
  183. be made more visible (6dB/octave gain will make harmonics whose amplitudes 
  184. drop as 1/frequency to have the same amplitude; 12dB/octave will make 
  185. harmonics whose amplitudes drop as 1/frequency^2 to have the same amplitude.)
  186.  
  187. 4) Added a bunch of run-time options for modifying the display.
  188.  
  189. 5) Added more information in the header display
  190.  
  191. 6) Added an INI file for setting defaults, so that you don't have to specify
  192. all of your favorite options on the command line.
  193.  
  194. 7) Allow modification of display colors (through the FREQ.INI file).
  195.  
  196. 8) Background flashes a warning color when saturation of the input occurs.
  197. (This flashing can be disabled by setting the background color and the
  198. clipping warning color to the same values in the INI file.)
  199.  
  200. TIME COMPARISONS:
  201.  
  202. The following times are the amount of time required for one program loop,
  203. which includes windowing the data, performing the FFT, and plotting the data.
  204. All measurements were made on a 486/33 with zero input, and as such represent 
  205. the minimum amount of time for one loop.  The time increases as the amount
  206. of plotting increases (i.e. when the input amplitude increases).  Prev.ver.
  207. refers to the first version of the program that I posted.
  208.  
  209.                   Linear Amp    Log Amp
  210. Prev.ver. w/286:    122.8ms      98.7ms
  211. Prev.ver. w/386:     70.7ms      59.2ms
  212. FREQ w/ 286 code:    71.8ms      62.6ms
  213. FREQ w/ 386 code:    32.6ms      27.5ms
  214. FREQ387              19.1ms      19.0ms
  215.  
  216.  
  217. If you have any questions or bug reports, you can contact me at:
  218.  
  219. Internet:    phillipv@engin.umich.edu
  220.  
  221. Compuserve:  71214,2302
  222.  
  223. Philip VanBaren
  224. 1845 Lake Lila Dr.  Apt. C3
  225. Ann Arbor, MI  48105
  226.