Document toolboxDocument toolbox

(8.D.2.7) Rebuffer

Overview

Overlaps data into larger block sizes. The underlying time base is preserved.

Discussion

A rebuffer module converts from a smaller to a larger block size, with overlap. The module can support an artibrary number of channels and also supports any 32-bit data type (integer and floating-point). An internal buffer holds the overlap between samples.

At instantiation time, the output block size is specified by the variable OUTBLOCKSIZE. If OUTBLOCKSIZE is positive (e.g., 64), then a specific output block size (64) is set. If OUTBLOCKSIZE is negative (e.g., -4), then this specifies that the output block size is 4 times greater than the input block size.

Even though the output block size is larger, the block output rate is the same as the input block rate. That is, this module does not change the fundamental block time. Assume the bufferBlockSize = -4.  The output block size is now 4*block size. In the table below, assume as we move down the table, time increases by one block period for each row.  Each row represents one output block.  Only one new buffer is added to the output block per block period, but a row of data is output.

Time

 

 

 

 

0

Buffer1

-

-

-

1

Buffer2

Buffer1

-

-

2

Buffer3

Buffer2

Buffer1

-

3

Buffer4

Buffer3

Buffer2

Buffer1

4

Buffer5

Buffer4

Buffer3

Buffer2

5

Buffer6

Buffer5

Buffer4

Buffer3

Type Definition

typedef struct _ModuleRebuffer { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 outBlockSize; // Specifies the size of the output block. Positive values indicate a specific block size, in samples. Negative values specify a multiplicative factor between the input and output block sizes. INT32 overlap; // Number of samples of overlap between blocks. Set by the prebuild function. INT32 stateIndex; // Index of the oldest state variable in the array of state variables. FLOAT32* state; // State variable array. } ModuleRebufferClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

outBlockSize

int

const

0

-2

-32:100000

 

overlap

int

const

1

32

Unrestricted

 

stateIndex

int

state

1

0

Unrestricted

 

state

float*

state

1

[32 x 1]

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: {float, int, fract32}

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

Output Pins

Name: out

Description: audio output

Data type: {float, int, fract32}

MATLAB Usage

File Name: rebuffer_module.m

M=rebuffer_module(NAME, OUTBLOCKSIZE) Creates a rebuffering module which changes the output block size. The module performs buffering and generates output blocks that overlap in time. The output blocks are generated at the same rate as the input blocks. Arguments: NAME - name of the module. OUTBLOCKSIZE - number of samples in each output block. The amount of overlap equals OUTBLOCKSIZE - M.inputPin{1}.type.blockSize. That is, the difference between the output and input block sizes. The module supports an arbitrary number of channels. Each channel is processed independently. If OUTBLOCKSIZE is positive, then it is treated as the specific size of the output block (as in the above discussion). If OUTBLOCKSIZE is negative, then it is treated as an integer multiplicative factor between the input and output block sizes. For example, if OUTBLOCKSIZE = -3, then the output block size equals 3 times the input block size.

Â