function RemezLength(bands: TDoubleArray; gains: TDoubleArray; Ripple: TDoubleArray; Weights: TVec; FS: Double): Integer;
Estimate the length of an optimal equiripple FIR filter and build its error-weight vector.
| # | Name | Description |
|---|---|---|
| 1 | bands | Band-edge frequencies in ascending pairs, relative to FS. |
| 2 | gains | Desired gain for each band (one per band). |
| 3 | Ripple | Maximum allowed ripple for each band (one per band |
| 4 | positive). | |
| 5 | Weights | Destination vector |
| 6 | receives one normalised error weight per band. | |
| 7 | FS | Sampling frequency used to normalise bands |
| 8 | default 2. |
Returns: Int32 - The estimated filter length (>= 3).
Estimates the number of taps for a Parks-McClellan (remez) design over the given multi-band specification, and as a side effect fills Weights with one error weight per band, normalised so the smallest required ripple maps to weight 1 and tighter-ripple bands get proportionally larger weights: w_i prop (max_j ripple_j)/ripple_i . The length estimate uses the worst-case transition band and is clamped to at least 3; when the highest-frequency band is a passband the length is forced odd. Pass the returned length to remez as the impulse-response size, and pass Weights as its weight array.
Domain: bands holds the band edges in pairs (length 2* the number of bands), one gain and one ripple per band, all relative to FS; gains, ripple and the number of bands must be consistent or an exception is raised.