ASN FilterScript – Getting started guide
Get up and running within minutes, with the ASN Filter Designer’s symbolic math scripting language IDE.
Get up and running within minutes, with the ASN Filter Designer’s symbolic math scripting language IDE.
ASN Filter Designer’s Filter Script language and IDE is a feature-rich propriety scripting language developed by ASN, aimed at providing you with a safe environment for experimenting with the design and optimisation of exotic symbolic filter transfer functions in real time and then testing them out on captured or simulated datasets. The optimised filter can then be deployed to Matlab, Python or C# for use in an ML project or even to an embedded processor for implementation in an AIoT application, in just a few clicks.
The language uses a similar construct to existing technical computing languages and builds upon the capabilities of the ASN Filter Designer’s classical graphical filter designer by providing over 82 design methods and scientific commands for filter design and mathematical operations. Our DSP experts have developed a number of filter design methods for both IIR and FIR filters, allowing you to get on with your experimentation rather than stressing over the details of the implementation.
The FilterScript IDE (integrated development environment) provides you with all of the necessary features in order to design and evaluate your symbolic filter concept. The IDE output is coupled to the filter designer UI, providing a fully interactive method of customising your filter transfer function on the fly.
As seen, the IDE is split up into a code editor and an output window. The IDE differs from other scripting IDEs in that all executed code appears in the output window, and there is no provision for entering and evaluating expressions in the output window directly.
As with all standard code editors, right clicking in the editor produces a standard options menu for copying, pasting, cutting and adding/removing comments respectively.
An IntelliSens is provided in order to help with the syntax of commands.
The primary purpose of the symbolic FilterScript code is to obtain values for the following three inputs:
Num
: the numerator coefficientsDen
: the denominator coefficientsGain
: the filter gainIn order to provide a flexible means of modifying parameters on the fly (see Interface Variables), the code is spilt up into two sections:
contains all definitions of interface variables and any constant expressions. This section is run only once after compilation.
contains the bulk of the code, including the Num
, Den
and Gain
. Any expressions containing interface variables will be updated when modified via the interface variable GUI.
The basic code structure is summarised below:
[code language=”java”]
// comments
ClearH1;
interface variables
const variables
Main()
Num = {}; // comments
Den = {};
Gain = 1;
[/code]
The ClearH1
expression allows you to remove the H1 filter (primary) from the filter cascade and just use the H2 (secondary) filter. The relationship of all filters (i.e. H1, H2, Heq and H3) in the filter cascade is shown below:
As seen, the main FIR/IIR filter designed via the filter designer GUI is assigned to the primary filter, H1. All poles and zeros defined via the filter script are added to a secondary filter block, H2. The H2 filter block implements the filter as a single section (i.e. no biquads) IIR, which eases the implementation, but also the advantage of assigning poles to an FIR primary filter. In the case of no poles, the H2 filter becomes an FIR filter.
It should be noted that a direct form (single section) implementation may become problematic (due to numerical stability issues) for higher IIR filter orders, especially when poles are near to the unit circle.
The Heq (all-pass filter) and H3 (post filter) filters must be disabled via the main UI if they are not required.
Central to the interactivity of the tool are the so called interface variables. An interface variable is simply stated:
a scalar input variable that can be used modify a symbolic expression without having to re-compile the code.
As discussed in the above section, interface variables must be defined in the initialisation section of the code, and may contain constants (such as, fs
and pi
– see the reference guide for the complete list) and simple mathematical operators, such as multiply *
and /
divide. Where, adding functions to an interface variable is not supported.
An interface variable is defined as vector expression:
interface name = {minimum, maximum, step_size, default_value};
where, all entries must be real scalars values. Vectors and complex values will not compile.
Examples
interface alpha = {-1,1,0.1,0.3} ; |
sets the variable alpha to 0.3 , and bounds the range to ±1, in steps of 0.1 . |
interface fc = {-fs/2,fs/2,1,fs/10} ; |
sets the variable fc to fs/10 , and bounds the range to ±fs/2 , in steps of 1 . |
Lipperkerstraat 146
751DD Enschede
The Netherlands
Tel: +31 652460840
General enquiries: info@advsolned.com
Technical support: support@advsolned.com
Sales enquiries: sales@advsolned.com