Skip to main content
Skip table of contents

FIRReader

Overview

FIR filter which works together with the DelayStateWriter module

Discussion

This module implements an FIR filter which works in conjunction with an upstream delay_state_writer_module.m. The delay_state_writer_module.m holds the state variables and can be shared by multiple FIRReader modules.

You need to make sure that the maximum number of coefficients does not exceed the allocated size of the upstream state buffer and that the number of channels match those from the state's buffer input pin. Checkings are made though at run-time and provided in the error code state: 0 = OK; -23 = channel count do not match; -67 = numTaps > (maxDelay-blockSize)); -79 = input ptr NULL; Output will be muted in case one of the above errors have occurred.

Type Definition

CODE
typedef struct _ModuleFIRReader
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 numTaps;                                // Length of the filter.
    INT32 errorCode;                              // Captures errors that could arise at run-time and which appears on the inspector
    INT32 dswObjectID;                            // Object ID of the upstream DelayStateWriter module
    FLOAT32* coeffs;                              // Filter coefficient array in normal order
    void * dswObjectPtr;                          // Points to the upstream DelayStateWriter module
    void * hardware_specific_struct_pointer;      // This is the internal TCB array used for ADI FIR accelerator
} ModuleFIRReaderClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

numTaps

int

const

0

20

Unrestricted

errorCode

int

state

0

0

Unrestricted

dswObjectID

int

state

1

-1

Unrestricted

coeffs

float*

parameter

0

[20 x 1]

Unrestricted

dswObjectPtr

void *

state

1

Unrestricted

hardware_specific_struct_pointer

void *

state

1

Unrestricted

Pins

Input Pins

 Name: ID

 Description: delayStateWriter instance input

 Data type: int

 Channel range: 1

 Block size range: 1

 Sample rate range: Unrestricted

 Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: float

MATLAB Usage

File Name: fir_reader_module.m

CODE
M = fir_reader_module(NAME, NUMTAPS, NUMCHAN, BLOCKSIZE, SAMPLERATE)
 Creates an FIR filter which works in conjunction with the 
 delay_state_writer_module.m.  The "writer" module stores the circular 
 state buffer while this "reader" module does the actual processing.  
 The "writer" module output is a pointer to its instance structure.  
 The "reader" module uses the instance pointer to read data out of the 
 state buffer.
 Arguments:
    NAME - name of the module.
    NUMTAPS - length of the filter (number of taps)
    NUMCHAN - output channel count.  
              By default, NUMCHAN = 1.
    BLOCKSIZE - output block size (number of samples to generate).
        If this is empty then we use the blockSize from the system
        input.  By default, BLOCKSIZE = [].
    SAMPLERATE - sample rate of the output data.  If this is empty
        then we use the sample rate of the first input pin of the
        containing system.  By default, SAMPLERATE = [].
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.