home *** CD-ROM | disk | FTP | other *** search
/ Computer Club Elmshorn Atari PD / CCE_PD.iso / pc / 0600 / CCE_0682.ZIP / CCE_0682.PD / DSP_FILT.ER / DSP.DOC next >
Text File  |  1993-01-23  |  11KB  |  211 lines

  1.  
  2.         DSP Version 1.0
  3.  
  4. --------------------------------------------------------------------------------
  5.  
  6. This program is FREE.  You may distribute it at will, provided you
  7.  
  8.         1) do not charge any money for it,
  9.         2) distribute it WITH the documentation, and
  10.         3) do not change the program or documentation in ANY WAY.
  11.  
  12. --------------------------------------------------------------------------------
  13.  
  14. 1. Introduction
  15.  
  16.    DSP is a Digital Signal Processing program which allows you to create
  17. high pass and low pass digital filters, and use them to process digital
  18. information.  I wrote the program to try to get rid of that annoying
  19. "warp drive rumble" that seems to be in the background of all Star Trek TNG
  20. audio samples.  I also needed an excuse to FINALLY learn GEM programming on
  21. the ST.  Although DSP was written to process audio samples, it's really a
  22. general purpose digital filter program, so you can use it on any digital
  23. information.
  24.  
  25.  
  26. 2. The "cover yer butt" section
  27.  
  28.    This being my first program to be released into the public domain, I don't
  29. know much about the legal remifications.  But I've downloaded enough software
  30. to have noticed that almost EVERYONE puts in a disclaimer of some kind.
  31. I copped this one from a public domain program.  It seems to have enough legal
  32. mumbo jumbo to discourage any litigious griper.
  33.  
  34.     This software is freeware.  As such, it is provided on an as-is basis,
  35.     with absolutely no warantees, either express or implied, including, but not
  36.     limited to performance, usefulness, reliability, fitness for a particular
  37.     purpose or merchantability.  The user assumes any and all risk involved in
  38.     the use of this software.  In no event will the author be liable for
  39.     direct, indirect, incidental, or consequential damages resulting from the
  40.     use of, or inability to use, this software.
  41.  
  42. So there!
  43.  
  44. 3.  A few notes.
  45.  
  46.    DSP runs in medium or high resolution.  I don't have a TT to try it on, but
  47. it should work in higher resolutions too.  I couldn't get everything to fit
  48. comfortably on a low rez screen, so the program will complain if you try to
  49. use it that way.
  50.  
  51.    My ST computer has 2.5 meg of memory, but I've used Jeremy Hughes's
  52. 520ST.TOS program to make it think it only has 512k, and DSP still works OK.
  53. Audio samples can chew up a lot of memory and I didn't want to restrict DSP's
  54. use by requiring that the entire sample fit in memory.  Hence DSP breaks
  55. the digital info into 4k blocks and processes it a little at a time.  The
  56. good news is that there should be no memory or sample size restrictions.
  57. The bad news is that since the audio samples never reside completely in memory,
  58. the program can't play them back.
  59.  
  60.    This restriction means the program is not very interactive.  You can't filter
  61. an audio sample, listen to it, change the filter and refilter it, listen to it
  62. again, etc.  Well, you can, but you need another program to listen to the
  63. sample, and keep switching between DSP and the other program.  If you've
  64. bought an audio digitizer (eg. STReplay) you already have software to replay
  65. samples.  There are also several public domain program which will do the trick.
  66. (DMJ Software has a nice shareware program called Sound Lab and Dave Baggett
  67. has written several nice audio programs (eg. PLAY.PRG).  All are available
  68. for downloading in GEnie).
  69.  
  70.  
  71. 4. So do something
  72.  
  73.    To start things rolling put DSP.PRG and DSP.RSC in the same folder and
  74. double click on the program file.  You'll be presented with the one and
  75. only dialog screen.  (Originally I wanted to make DSP a desk accessory,
  76. so there's no menu bar).
  77.  
  78.    The dialog is divided into two parts.  The top part is for specifying the
  79. filter parameters and the bottom part is for processing data thru the filter.
  80. The first thing you want to do is CREATE a filter.
  81.  
  82.    To CREATE a filter select either LOPASS or HIPASS depending on what kind
  83. of filter you want to create.  You also need to know the sample frequency
  84. of the digital data you'll be working with.  Enter this infomation in the
  85. "Sample freq: __.__ khz" field.  Now enter the desired filter cutoff frequency
  86. in the next field.  NOTE: the program will complain if you enter a cutoff
  87. frequency that is greater then 1/2 the sample frequency.  This implies you're
  88. trying to filter out frequencies that are greater then the nyquist frequency,
  89. which doesn't make sense.
  90.  
  91.    Next use the up/down arrow buttons to select the number of
  92. coefficients to create.  (Don't be alarmed when you only see odd
  93. numbers.  That's the way it's supposed to work.)  The more coefficients you
  94. use the better filter you'll create.  Filters with less then 20
  95. coefficients generally aren't very good, while 99 coefficients will give you
  96. exceptionally sharp filter characteristics.  On the down side, the more
  97. coefficients you use the longer it takes the computer to calculate them, and
  98. the longer it will take to process your digital info thru the filter.  Such is
  99. the give and take of life.
  100.  
  101.    Now click on the CREATE button.  The progress bar in the lower left hand
  102. corner of the display will show the computers progress as it computes the
  103. filter coefficients.  NOTE: the process of calculating filter coefficients
  104. is an iterative one, which requires the computer to converge on a solution.
  105. As such, it's hard to determine when it will reach a solution.  The progress
  106. bar is only a rough estimate of how close the computer is to finishing its
  107. task.  It's really only there to provide that "warm fuzzy" feeling to the
  108. user that everythings working OK.  I've got a 16MHz accelerator in my ST and
  109. it still takes about 45 seconds to create a filter with 99 coefficients.
  110. Patience is definitely a virtue, if you want to create high caliber filters.
  111.  
  112.    When the computer is done the progress bar and CREATE button will clear.
  113. You might want to use the SAVE button to save the filter to disk.  You can
  114. use the LOAD button to load the filter at a later time, and not have to go
  115. thru the create process all over again.  There are a couple SAVE'd filters
  116. in the download.  DC.FLT filters out very low frequencies.  There's a sample
  117. on GEnie called HAL9000.SND (a sample of the voice of HAL from the movie
  118. 2010, I think) which has a DC offset in it and I used DC.FLT to clean it up.
  119. NOISE.FLT is a general purpose low pass filter I've used to filter out
  120. high frequency noise.
  121.  
  122.  
  123. 5. Processing data
  124.  
  125.    Now that you've got a filter, you'll want to use it.  You'll need to know
  126. if your samples are created using signed or unsigned format (for all you Sound
  127. Lab users, "signed" format is the same as setting the "High Bit" in Sound
  128. Lab).  All the samples I have use the unsigned format and that is the default.
  129. However, I've heard that the STE's DMA playback requires samples in the signed
  130. format.  I guess the best thing to do is try filtering a sample using the
  131. unsigned format and if the filtered sample sounds awful, try the signed
  132. format.  One of the two formats should work for you, and is selectable with
  133. the two buttons underneath the "Input Sample" button.  NOTE: I've also heard
  134. some samples have "header" information at the beginning.  DSP assumes the
  135. entire input file is sample data and any header information will be lost in
  136. the output file.  If anyone has any information on file "headers", pass it on
  137. to me and I'll account for it in the next version of DSP.
  138.  
  139.    Click on the "Input sample" button and select a sample file to filter. Click
  140. on the "Output sample" button and select a filename to store the filtered
  141. sample.  Then click "Process signal".  The computer will crunch away at the
  142. input file and produce the output file.  NOTE: in this case the progress bar
  143. is an accurate indicator of the computers progress.
  144.  
  145.    That's about it.  I usually create a few similar filters and process
  146. the input sample with each of them.  Then exit DSP and playback the results
  147. and keep the one I like the most.
  148.  
  149.  
  150. 6. Techoid stuff
  151.  
  152.    For the technically inclined:
  153.  
  154.    DSP uses the remez exchange method to create the filter coefficients.
  155. Although this method can create very complex multi-passband filters, it's
  156. been restricted to only low pass and high pass filters for DSP's purposes.
  157. Also, Remez exchange can create filters with varing degrees
  158. of "ripple" in the pass and stop bands, as well as different filter
  159. slopes.  Much of this flexability has also been hardcoded into DSP to
  160. make life easy.  In general the filter characteristics have been chosen
  161. to yield a filter with around 1db of ripple in the passband and -40db
  162. attenuation in the stop band.  The filter slope varies from 0.05Hz (normalized)
  163. for filters with less then 35 coefficients to 0.015Hz (normalized) for
  164. filters with greater then 85 coefficients.
  165.  
  166.    If the paragraph above means nothing to you and you want to learn more about
  167. digital filters, I highly recommend a book by Nicholas Loy titled,
  168. "An Engineers Guide to FIR Digital Filters."  It's a short book that cuts
  169. thru all the math and presents digital filters in a practical light.  There's
  170. even some BASIC code to do digital filter design, which is the basis
  171. behind DSP.
  172.  
  173.    As an aside I'll mention that the digital filters performance depends
  174. on the RATIO of the sampling and cutoff frequencies, NOT on their absolute
  175. values.  Therefore, a 51 coefficient lowpass filter created for a 20.00khz
  176. sampling frequency with a 5.00khz cutoff frequency will behave EXACTLY
  177. like a 51 coefficient lowpass filter created for a 10.00khz sampling
  178. frequency with a 2.50khz cutoff frequency.  (the ratio of sample frequency
  179. to cutoff frequency is the same for the two filters).  If you're going to
  180. create a library of filters, you should keep this in mind.  You don't need
  181. two such filters, one will do.
  182.  
  183.  
  184. 6. Support
  185.  
  186.    Although the end of my Christmas vacation will severely hamper work on
  187. DSP, I'd like to hear from you.  Good comments, bad comments, bug reports,
  188. suggestions, whatever.  If you come up with a nifty application for DSP,
  189. I'd like to hear about it.  I can be reached via GEnie as K.LORD.
  190.  
  191.    Future enhancements will include:
  192.  
  193.    1. Activate the menu bar, so people will have access to desk accessories.
  194.  
  195.    2. Incorporate some kind of sample playback feature.  I tried using Pexec()
  196.       and Dave Baggett's PLAY.PRG program, but it didn't work.  If anyone has
  197.       some sample playback code they'd like to share, it would be
  198.       appreciated.
  199.  
  200.    3. The "filter" box in the "Process Signal" box is currently blank.  I was
  201.       going to put in a graphic showing the current filters frequency responce,
  202.       but never got around to it.  Like I said, Christmas vacation is coming
  203.       to an end.
  204.  
  205.    4. An option to create passband, notch and other more complex filters.
  206.  
  207.    5. An option to create filter sweeps.
  208.  
  209.  
  210. Keith Lord    12/29/92
  211.