home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / musica / resample / src / remez.h < prev    next >
C/C++ Source or Header  |  1999-12-03  |  2KB  |  42 lines

  1. /*************************************************************************\
  2.       "remez.h": include file for programs to link with "remez.o"
  3.  (for design of FIR linear phase filters by the Remez Exchange algorithm)
  4. \*************************************************************************/
  5.  
  6. #define NFMAX 256           /* max. filter length */
  7. extern float h[ NFMAX ];    /* impulse response of the computed filter */
  8. extern int remez_talk;      /* terminal output while calculating? */
  9. extern int remez_dot;       /* simple output: one dot for each iteration */
  10.  
  11. int makefilter(int length); /* call this to do the job */
  12. #define REMEZ_OK        0   /* possible return values: */
  13. #define REMEZ_UNSURE    1   /* <- indicate convergence problems */
  14. #define REMEZ_FAIL      2   /* <- */
  15. #define FILTER_TOO_LONG 3   /* length > NFMAX? */
  16. float extreme(float freq);  /* Returns an extremal value of the frequency
  17.                              * response, to be precise: the one that is
  18.                              * nearest to the specified frequency
  19.                              * (0<=freq<=0.5). Example: for a low pass
  20.                              * filter you could call extreme(0) and
  21.                              * extreme(0.5). Let the return values be
  22.                              * 0.985 and -0.0015, then you can tell that
  23.                              * the pass band ripple is +/-1.5 %, the stop
  24.                              * band attenuation -56 dB.
  25.                              */
  26.  
  27. /* These two functions must be implemented in the calling program: */
  28. float desire(float freq);   /* Magnitude of response,
  29.                              * where freq is the normalized frequency.
  30.                              * Prepare for values 0<=freq<=0.5.
  31.                              */
  32. float weight(float freq);   /* Which parts of the frequency response are
  33.                              * more importantant?
  34.                              * Stop bands usually are, and make sure that
  35.                              * there are always transition bands (with a
  36.                              * weight of 0, i. e. undefined response)
  37.                              * between pass bands and stop bands. The wider
  38.                              * the transition bands, the less ripples in
  39.                              * the other bands can be achieved.
  40.                              */
  41.  
  42.