Document toolboxDocument toolbox

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

Â