pyfda: a filter design tool

pyfda is a tool written in Python / Qt for analyzing and designing discrete time filters with a user-friendly GUI. Fixpoint filter implementations (for some filter types) can be simulated and tested for overflow and quantization behaviour in the time and frequency domain. It is developed separately under MIT license, and has been modified to be adapted to our needs and comfort: to be able to launch it locally, a focus on audio features, SFU filter export capabilities, and making it better integrated into the GAP SDK.

The full pyfda documentation can be read here <https://pyfda.readthedocs.io/en/latest/README.html>.

1. Launch pyfda

The launch script is located in $GAP_SDK_HOME//tools/audio-framework/utils/python/pyfda/pyfda_run.py. Run it to launch the tool. If all dependencies have been correctly installed following the GAP SDK instructions, it should launch and display a window looking like this:

../../../../../../../_images/main_window.png

2. Designing a filter

Two main categories of filter are available: FIR and IIR filters. Both contain the following filter types: * Highpass * Lowpass * Bandpass * Bandstop * Differentiator * Hilbert

Each filter type has several forms available, and can be set according to different specifications. It is not the goal of this document to explain how to design a digital filter.

3. Exporting to SFU

Once a filter has been designed, it is possible to export it as an SFU .src file.

Although FIR filters have only one possible form and working algorithm, IIR filters can be used in three different forms: as a single IIR filter, or as a cascade of biquads, in either direct form 1 or direct form 2.

To export a filter, click on b,a to display the coefficients tab:

../../../../../../../_images/to_ba_tab.png

This dialog allows users to manipulate coefficients individually, import coefficients from a CSV, Matlab or Python file, or export them in equivalent formats.

Click on Export coefficients to open the export dialog.

../../../../../../../_images/export_coefficients.png

The option selected by default should be GAP SFU SOS DF1 (biquad cascade, Direct Form 1) for IIR filters, or GAP SFU FIR for FIR filters. Other options include CSV, Matlab and Numpy formats, or a collection of other formats depending on which packages are installed.

../../../../../../../_images/export_dialog.png

Warning

A bug currently prevents from exporting coefficients if the exported file name contains the .src extension. To get around that bug, just remove any extension from the export name. pyfda will add it back by itself.

Note

Importing coefficients from a GAP SFU .src file is not yet supported.