Sounds Logical
home

WaveWarp Users' Guide: last updated 28 February 2002

Table Of ContentsPrevious PageNext Page

9.1-- ASCII file format for Digital Filter coefficients

In order for you to produce WaveWarp-readable filter files from an external application, the appropriate file specifications are included below. The file format is straightforward, with minor modifications depending on the type of filter in question. All filter coefficients are stored in floating point double-precision (64 bit) format (although WaveWarp truncates them to 32 bit format for real-time processing).

There is no requirement on the filename or the filename extension. However, to avoid confusion it is advisable to stick to the default extension ".txt" as appears by default in the WaveWarp filter file I/O dialog boxes.

9.1.1-- FIR file specification

In WaveWarp, the FIR filter transfer function is assumed to be of the form:

      Y(z) = [ B(1) +B(2) z -1 + ... + B(N) z -N+1 ] X(z)

The filter coefficients are stored in the ASCII file as described in Table 8.

Table 8 ASCII file structure for storing FIR filter coefficients readable by WaveWarp

Line number

Entry

Notes

1

WW_FILTER_FIR

Description of the filter type (string variable type).

2

N

Length of the FIR filter (integer variable type).

3 to N+2

B(1) to B(N)

Filter coefficients (double variable type).

See for example the files in the "wwfilters/demo_fir" sub-directory of the WaveWarp root directory.

9.1.2-- IIR Direct Implementation file specification

In WaveWarp, the IIR direct implementation filter transfer function is assumed to be of the form:

      Y(z) [1 + A(2) z -1 + ...+ A(NA) z -NA+1] =[ B(1) +B(2) z -1 + ... + B(NB) z -NB+1 ] X(z)

Note that the leading term in the denominator - i.e. the coefficient A(1) - is restricted to be unity. (This leads to no loss of generality since a non-unity leading term "divides out" and has no effect on the outcome of the filter once it has been implemented.)

The filter coefficients are stored in the ASCII file as described in Table 9.

Table 9 ASCII file structure for storing IIR filter coefficients (direct implementation) readable by WaveWarp

Line number

Entry

Notes

1

WW_FILTER_IIR_DIRECT

Description of the filter type (string variable type).

2

NB

Number of numerator coefficients stored in file (integer variable type). This is equal to the length of the IIR filter numerator.

3

NA - 1

Number of denominator coefficients stored in file (integer variable type). This is equal to the length of the IIR filter denominator minus one since the leading term A(1) is assumed to be unity and is not stored in the file.

4 to NB+3

B(1) to B(NB)

Numerator filter coefficients (double variable type).

NB+4 to NB+NA+2

A(2) to A(NA)

Denominator filter coefficients (double variable type) omitting the leading unity term.

See for example the files in the "wwfilters/demo_iir/direct" sub-directory of the WaveWarp root directory. Note that as well as a general arbitrary-order filter component, WaveWarp also has a range of simple "2-pole" filters which also use the direct IIR form (with NA =NB=3) for their file I/O. There are examples of such filters in the same sub-directory.

9.1.3-- IIR Cascaded Second Order Implementation file specification

In WaveWarp, the IIR cascaded second order implementation filter transfer function is assumed to be of the form:

Y(z) = K* [ TF(1) * TF(2) *...* TF(L) ] X(z)

where K is an overall gain factor, and each of TF(1) to TF(L) is a second order transfer function of the form:

      YJ(z) [1 + AJ(1) z -1 + AJ(2) z -2] =[ 1+BJ(1) z -1 + BJ(2) z -2 ] XJ(z)

The total number of cascaded subsystems is represented by L which is given by:

L=floor((order+1)/2)

where order is the overall order of the total filter. (Note that whenever the overall order is odd, then the first subsystem will actually be first order rather than second order i.e., such that A1(2)=B1(2)=0).

The filter coefficients are stored in the ASCII file as described in Table 10.

Table 10 ASCII file structure for storing IIR filter coefficients (cascaded second-order implementation) readable by WaveWarp

Line number

Entry

Notes

1

WW_FILTER_IIR_QUAD

Description of the filter type (string variable type).

2

Order

Overall filter order (integer variable type).

3

K

Overall filter gain (double variable type).

4 to 4*L + 3

B1(1), B1(2), A1(1), A1(2)

To

BL(1), BL(2), AL(1), AL(2)

Cascaded IIR filter coefficients (double variable type) ordered as indicated.

See for example the files in the "wwfilters/demo_iir/sos" sub-directory of the WaveWarp root directory.

Table Of ContentsPrevious PageNext PageTop Of Page

home - news - products - store - support - site map - company info
© 2007 Sounds Logical. All rights reserved.
Sounds Logical
legal notice - privacy statement