Document toolboxDocument toolbox

(8.D.2.1) FIRSparseReaderFract32

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.

Type Definition

typedef struct _ModuleFIRSparseReaderFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 numTaps; // Number of non-zero coefficients (taps) in the filter INT32 postShift; // Number of bits to shift 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 fract32* tapCoeffsFract32; // Fract32 coefficient applied to each tap output void * dswObjectPtr; // Points to the upstream DelayStateWriter module } ModuleFIRSparseReaderFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

numTaps

int

const

0

20

Unrestricted

 

postShift

int

derived

1

1

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

 

tapCoeffsFract32

fract32*

derived

0

[20 x 1]

Unrestricted

 

dswObjectPtr

void *

state

1

 

Unrestricted

 

Pins

Input Pins

Name: ptr

Description: Pointer to the DelayStateWriter16 instance structure

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: fract32

MATLAB Usage

File Name: fir_sparse_reader_fract32_module.m

M = fir_sparse_reader_fract32_module(NAME, NUMTAPS, BLOCKSIZE, SAMPLERATE) Creates a fract32 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 = [].

Â