Classic FIR Filter Bank - User Guide
Designs and optionally applies linear-phase FIR filters: six windowed-sinc families, Moving Average, Raised-Cosine, and a finite-length Hilbert transformer.
What this does
The script designs a finite impulse response (FIR) filter from the selected settings, plots its response if requested, and can convolve it with exactly one selected Sound. The main windowed-sinc designs are linear-phase because their coefficients are symmetric. The Hilbert transformer uses the corresponding antisymmetric FIR form: it also has constant group delay, but deliberately introduces a quadrature phase relationship rather than behaving like an ordinary magnitude filter.
For multichannel input, Praat convolves every channel with the same mono FIR impulse response. Channel count is therefore preserved; the script no longer collapses non-mono material to stereo.
Quick start
- Select exactly one Sound object.
- Run
Classic_FIR_Filter_Bank.praat. - Choose a preset, or leave Custom and select a filter family and mode.
- Set Filter_length. Even values are automatically increased by one so the design has an odd number of taps.
- For Lowpass or Highpass, set Cutoff_frequency. For Bandpass or Bandstop, set both cutoff frequencies.
- Set Dry_wet_mix and Scale_peak if audio will be rendered.
- Use the plot switches to inspect the designed response, and Apply_filter to create audio output.
Presets
Presets replace only their filter-design fields. Dry/wet, target peak, plotting, filtering, and playback remain at the values entered in the form.
| Preset | Filter | Mode | N | Cutoff(s) |
|---|---|---|---|---|
| Custom | Uses the values entered in the form. | |||
| Speech Lowpass | Windowed-sinc Hamming | Lowpass | 101 | 3500 Hz |
| Music Lowpass | Windowed-sinc Blackman | Lowpass | 127 | 8000 Hz |
| Rumble Filter | Windowed-sinc Blackman | Highpass | 255 | 80 Hz |
| Bandpass Voice | Windowed-sinc Hamming | Bandpass | 127 | 300-3400 Hz |
| Hilbert 90deg Phase | Hilbert Transform | Hilbert design | 127 | Cutoff fields do not shape the Hilbert impulse response. |
Filter types
Windowed-sinc: Rectangular, Hamming, Hann, Blackman, Kaiser, Bartlett
These six choices share the same ideal lowpass core and differ only in the applied window. In v0.4.1 the cutoff normalization is corrected: the requested frequency is normalized to Nyquist and used directly by the ideal sinc design, so the transition is centred at the requested cutoff rather than near twice that value.
Highpass is produced by spectral inversion. Bandpass is formed from the difference between two lowpass designs at the requested lower and upper edges; Bandstop is the complementary inversion of that bandpass.
Moving Average
All taps are equal to 1/N. Filter_length, not Cutoff_frequency, controls its response. Lowpass and its spectrally inverted Highpass are supported. Bandpass and Bandstop are rejected because this family has no user-defined cutoff pair.
Raised-Cosine
The filter uses a finite sampled raised-cosine impulse response. In v0.4.1 its time units are consistent: T = 1/(2 * cutoff_frequency) seconds, evaluated at tap times m / sampleRate. The entered cutoff is the centre of the raised-cosine transition, approximately the -6 dB amplitude point of the ideal response. Rolloff_factor must be greater than 0 and at most 1.
Lowpass and Highpass are supported. For Bandpass and Bandstop, both edges are now constructed from Raised-Cosine lowpass designs with the same rolloff factor.
Hilbert Transform
This is a Hamming-windowed finite-length Hilbert transformer with odd-sample coefficients proportional to 2/(pi*m) and zeros at the centre and even offsets. It approximates the ideal quadrature response over its useful band; it is not a mathematically perfect 90-degree shifter at DC, Nyquist, or across every frequency of a finite-length implementation.
Controls
| Control | Default | Behavior |
|---|---|---|
| Preset | Custom | Applies one of the design presets above. |
| Filter_type | Windowed-sinc (Hann) | Selects one of six windowed-sinc designs, Moving Average, Raised-Cosine, or Hilbert Transform. |
| Filter_mode | Lowpass | Lowpass, Highpass, Bandpass, or Bandstop. Ignored for Hilbert; BP/BS are not allowed for Moving Average. |
| Filter_length | 101 | Number of FIR taps. Even values are increased by one; minimum 3. |
| Cutoff_frequency | 1000 Hz | First cutoff for cutoff-based filters; must be below Nyquist. It does not design the Moving Average or Hilbert response. |
| Cutoff_frequency_2 | 2000 Hz | Upper edge for Bandpass/Bandstop; must be above the first cutoff and below Nyquist. |
| Kaiser_beta | 5.0 | Used only by the Kaiser window. |
| Rolloff_factor | 0.5 | Used only by Raised-Cosine; allowed range is (0, 1]. |
| Dry_wet_mix | 1.0 | Clamped to 0-1. Wet and dry are mixed after delaying the dry by the FIR group delay. |
| Scale_peak | 0.95 | Target peak used after filtering/mixing. This is normalization, not a safety ceiling. |
| Plot_responses | On | Draws magnitude and wrapped phase response. |
| Plot_impulse | On | Draws the FIR impulse response. |
| Apply_filter | On | Creates the filtered Sound. Plots can still be produced with filtering off. |
| Play_after_processing | On | Plays the result when an output Sound was created. |
Processing & output
The FIR coefficients are placed in a mono impulse-response Sound and applied with Praat Convolve: "sum", "zero". A mono FIR can be convolved directly with mono, stereo, or higher-channel-count material, so each source channel is filtered independently with the same coefficients.
The output keeps the input sample rate and channel count.
The FIR impulse starts at time 0, so the output starts at the input start time. Convolution adds the FIR tail: the output has input sample count + N - 1 samples.
For these odd-length linear-phase designs, delay is (N - 1)/2 samples. The dry path is shifted by the same amount before mixing.
After the dry/wet mix,
Scale peak always scales a non-silent rendered output toward Scale_peak. It can attenuate or amplify.Because the target-peak stage is unconditional whenever Apply_filter is on, Dry_wet_mix = 0 returns the delay-aligned dry signal with its peak rescaled to the requested target. Use a target equal to the desired peak if level preservation matters.
Output names follow <source>_<filter type>_<mode>, for example sound_Sinc-Hamming_LP or sound_RaisedCos_BP. The Hilbert output still carries the selected mode suffix even though that mode transformation is not applied to the Hilbert coefficients.
Visualization
The Picture window uses the Praat AudioTools 8-inch layout and can show three diagnostics:
- Magnitude response: 512-point direct evaluation of the FIR coefficients from 0 to Nyquist, displayed from -80 to +10 dB. The red curve is the filter response; a dotted -3 dB reference and cutoff markers are included for non-Hilbert filters.
- Phase response: wrapped phase in degrees from -180 to +180. Large wrap jumps are deliberately not connected, so this is not an unwrapped straight-line phase plot.
- Impulse response: stems are drawn first and markers second, making coefficient symmetry or antisymmetry directly visible.
The summary strip reports filter family/mode, N, dry/wet value, target peak, sample rate, and channel count. For Bandpass/Bandstop the magnitude/phase panels mark both cutoffs.
Further Reading
- Oppenheim, A. V. & Schafer, R. W. (2010). Discrete-Time Signal Processing, 3rd ed. Pearson. General FIR, convolution, frequency response, and linear-phase foundations.
- Harris, F. J. (1978). "On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform." Proceedings of the IEEE, 66(1), 51-83. DOI: 10.1109/PROC.1978.10837. Direct reference for the window families and their spectral tradeoffs.
- Proakis, J. G. (2001). Digital Communications, 4th ed. McGraw-Hill. Reference for raised-cosine pulse shaping and rolloff.
- Hahn, S. L. (1996). Hilbert Transforms in Signal Processing. Artech House. Direct reference for Hilbert-transform theory and signal-processing applications.