Skip to content

FIRSparseReader

Overview

Sparse FIR filter which works together with the DelayStateWriter module

Discussion

This module implements a sparse FIR filter which is also known as a tapped delay line. This module stores only the coefficients and delay times and works in conjunction with an upstram delay_state_writer_module.m. The delay_state_writer_module.m holds the state variables and can be shared by multiple FIRSpareReaderModules.

You need to make sure that the maximum tapped delay time does not exceed the allocated size of the upstream state buffer. No checking is made at run-time that this is the case.

The module only outputs a mono channel of data and the output blockSize must be a multiple of 8 samples. This last condition is checked by the module's prebuild function.

Module Pack

Advanced

ClassID

classID = 1280

Type Definition

typedef struct _ModuleFIRSparseReader
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32 numTaps;                                // Number of non-zero coefficients (taps) in the filter
INT32 dswObjectID;                            // Object ID of the upstream DelayStateWriter module
INT32* tapDelay;                              // Current delay per tap
INT32* tapDelayTarget;                        // Current delay per tap
FLOAT32* tapCoeffs;                           // Coefficient applied to each tap output
void * dswObjectPtr;                          // Points to the upstream DelayStateWriter module
} ModuleFIRSparseReaderClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
numTaps int const 0 20 Unrestricted
dswObjectID int state 1 -1 Unrestricted
tapDelay int* parameter 0 [20 x 1] Unrestricted samples
tapDelayTarget int* state 0 [21 x 1] Unrestricted samples
tapCoeffs float* parameter 0 [20 x 1] Unrestricted
dswObjectPtr void * state 1 Unrestricted

Pins

Input Pins

Name ID
Description audio 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_sparse_reader_module.m 
 M = fir_sparse_reader_module(NAME, NUMTAPS, BLOCKSIZE, SAMPLERATE) 
 Creates a sparse FIR filter which is equivalent to a multi-tap time 
 delay in which the outputs are weighted and summed.  This module 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. 

 This module can only process a single mono channel of data. 

 Arguments: 
    NAME - name of the module. 
    NUMTAPS - number of taps 
    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 = []. 

Copyright (c) 2026 DSP Concepts, Inc.