UpFIRDnConverter
Overview
Converts sample rate of input wire and outputs data at new sample rate.
Discussion
Sample rate converter.\n The output sample rate is computed by L/D*SampleRateIn = SampleRateOut. If the ratio of the input sample rate to the desired output sample rate is irrational, the desired output sample rate will not equal the actual output sample rate. The input block size must be an interger multiple of D. The length of the filter must be > than L. L, D, and the optimal value for N can be calculated using the inspector.
Type Definition
typedef struct _ModuleUpFIRDnConverter
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 gd; // Group Delay or latency, calculated result
INT32 KAISER; // Filter type constant
INT32 PARKS_MCCLELLAN; // Filter type constant
INT32 CUSTOM; // Filter type constant
FLOAT32 fin; // Input Sample Rate
INT32 L; // Interpolation factor
INT32 D; // Decimation factor
INT32 filterType; // filter type of FIR
INT32 ND; // Integer multiplication factor
INT32 N; // length of FIR filter
INT32 NQ; // Size of QBUF, >= 2*Q, where Q = N/L (integer divide)
INT32 IQ; // QBUF index
INT32 JQ; // QBUF index, moving address index.
INT32 NC; // Size of array COFS
INT32 NCOEF; // Size of COEF array
FLOAT32* QBUF; // Internal buffer for storage of state variables of FIR filter
INT32* ICTR; // Buffer for storing control data
FLOAT32* COEF; // FIR symmetric filter coeffs
FLOAT32* COFS; // scrambled coeffs for FIR filter
} ModuleUpFIRDnConverterClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
gd | float | const | 0 | 0.1319 | Unrestricted | msec |
KAISER | int | const | 1 | 1 | Unrestricted | Â |
PARKS_MCCLELLAN | int | const | 1 | 2 | Unrestricted | Â |
CUSTOM | int | const | 1 | 3 | Unrestricted | Â |
fin | float | parameter | 1 | 48000 | Unrestricted | Â |
L | int | const | 1 | 3 | Unrestricted | Â |
D | int | const | 1 | 4 | Unrestricted | Â |
filterType | int | const | 1 | 1 | Unrestricted | Â |
ND | int | derived | 1 | 8 | Unrestricted | Â |
N | int | const | 1 | 39 | Unrestricted | Â |
NQ | int | const | 1 | 26 | Unrestricted | Â |
IQ | int | const | 1 | 13 | Unrestricted | Â |
JQ | int | derived | 1 | 13 | Unrestricted | Â |
NC | int | const | 1 | 39 | Unrestricted | Â |
NCOEF | int | const | 1 | 20 | Unrestricted | Â |
QBUF | float* | derived | 1 | [1 x 26] | Unrestricted | Â |
ICTR | int* | derived | 1 | [6 x 1] | Unrestricted | Â |
COEF | float* | derived | 0 | [20 x 1] | Unrestricted | Â |
COFS | float* | derived | 1 | [39 x 1] | Unrestricted | Â |
Pins
Input Pins
Name: in
Description: Input signal
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: Output signal
Data type: float
MATLAB Usage
File Name: up_fir_dn_converter_module.m
M=up_fir_dn_converter_module(NAME, L, D, N, filterType)
Performs rational sample rate conversion
Arguments:
NAME - Name of the module
L - Interpolation factor
D - Decimation factor
N - length of FIR filter used in the conversion process
filterType - Type of filter
Author: Darrel Judd
Â